the VNC diaries

When I need a remote desktop on a box in my LAN I usually go for tightvnc and things were going pretty well until I tried to execute hugin – software used for creating panoramas. It just died with a XV error. Turns out that the GLX extension is not available in tightvnc. After some googling I tried tigervnc – the fork that is promising GLX among other improvements. That didn’t worked out either because of an API change in xorg-server.1.5.3 (a .so lib crying out for TLS related symbols when being dlopened by tigervnc).

The last advanced VNC server that I know off, x11vnc, was already in use for exporting a real X11 display but looking at its homepage it became clear that there are ways to use it without one. And yes, it has GLX support.  Here’s the server setup (I put the following function in my .bashrc but feel free to use a script):

startx -- `which Xvfb` :1 -screen 0 1252x952x24 &
sleep 5
x11vnc -display :1 -ncache 5 -forever -usepw -N
killall Xvfb

What that does is starting a Xvfb instance in the background (it will use the RAM for rendering allowing for an efficient screen capture by the VNC server). The startx script will execute whatever you have in your .xinitrc. The screen size I want is 1252×952 with a 24 bit color depth. The function waits 5 seconds for the X server to start and then fires up x11vnc. I want the :1 VNC display because :0 is in use. The -ncache option does some interesting client-level image caching, -forever keeps the server from closing along with the first connection, -usepw switches on the standard VNC encryption (weak, 8 char passwords, but I don’t want the SSH overhead in this setup) and -N is there to make sure that the listening port will be the standard port + the display number.

The x11vnc server stays in the foreground while in use so when I’m done with it I do a Ctrl+C and the next line takes care of Xvfb.

Now let’s look at the client. In theory I could use vncviewer from tightvnc or tigervnc, but for best results and proper hiding of the ncache region its best to go with ssvnc from x11vnc’s author (it’s available on the same site and packaged by fine distributions like Gentoo). Here’s the shell alias:

alias vncbebop='echo bGgJjj87 | ssvncviewer -ycrop 952 -autopass \
 -quality 9'

The 8 char gibberish is of course the VNC password. A -ycrop equal to the display’s height needs to be specified otherwise ssvncviewer eats some pixels (automatic detection failure?); -autopass is there so the program will read the password from stdin; -quality is the JPEG compression level (the LAN connection can take the load) and the last argument is in the form server_ip:vnc_display.

The quality and responsiveness of the remote desktop is impressive, allowing for serious work to be done. The rare redrawing glitch can be fixed by navigating through the windows or using the F8 menu to force a redraw. Enjoy!
P.S.: versions used: x11vnc-0.9.7 and ssvnc-1.0.22 .

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s