I've run the X virtual framebuffer server on Ubuntu Linux which I'd like to access its screen via VNC.

Here are my steps:

  1. Xvfb :1.0 -screen 0 1024x768x16 &

  2. Setup password by: x11vnc -storepasswd.

  3. x11vnc -display :1.0 -usepw -forever -ncache 10 -autoport 5900 &

    Using X display :1.0
    rootwin: 0x1a9 reswin: 0x200001 dpy: 0x174f920
    Default visual ID: 0x21
    Read initial data from X display into framebuffer.
    initialize_screen: fb_depth/fb_bpp/fb_Bpl 16/16/2048
    rfbNewFramebuffer(0x1797f20, 0x0, 1024, 9216, 5, 1, 2)
    X display :1.0 is 16bpp depth=16 true color

Then I'm accessing the VNC server from macOS by:

open vnc://my-vnc-ip:5901/

However the frame buffer is too wide (1024x9216), like there are some extra 12 screens visible at the same time. Ideally I'd like to have only one display with 1024x768 screen only.

How can I correct it, so I can see the visible screen in the expected resolution?


It seems the issue was caused by the -ncache (an experimental) option. Removing it should fix it.

If it's enabled by default, try to disable it by using -noncache.

When enabled, it is basically activates the client-side caching scheme which stores pixel data offscreen on the VNC viewer side for faster retrieval and it should work with any VNC viewer. However it seems it's not working correctly with some clients.

So the correct command could be:

x11vnc -display :1.0 -usepw -forever -autoport 5900

In any other non-ncache case, the -clip option may help.

As per Ubuntu forum thread, this is how -ncache works.

It makes a desktop 10X taller than the normal height and uses the extra framebuffer for caching windows and their saveunders.

If you can't get KRDC to not show you that region (e.g. by resizing its window) then you can't use KRDC with x11vnc -ncache.

So for now the only -ncache "support" is for a viewer to be able to have a scrollbar and to be able to disable auto-scrolling. Or on unix/macosx use ssvnc.

See: Can x11vnc do client-side caching of pixel data? for further information.

The n in -ncache n is the factor of increase over the base framebuffer size to use for caching. It is an even integer and should be fairly large, 6-12, to achieve good response. This usually requires about 50-100MB of additional RAM on both the client and server sides. For example with n=6 a 1280x1024 display will use a framebuffer that is 1280x7168: everything below row 1024 is the pixel buffer cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.