Headless Pi3 with X11vnc

Right now, I have the full desktop of my Pi3 on my laptop. It was very easy to do, steps documented here.

To get going, I am trying the absolute simplest way of doing it. Not using ssh. On the Pi3 I am running the 'x11vnc' daemon, on the laptop running 'gvncviewer'. That's it.

Step 1: compile x11vnc
Puppy Forum member 'goingnuts' showed me how to compile an old version of x11vnc. This would be good if I wanted to create a static executable in a uClibc or Musl environment. But I am just running Quirky Xerus64 armv7 8.1.4 on my Pi3, so have glibc.

I downloaded the old x11vnc from here:

I modified the instructions from goingnuts, compiled it like this:

for x in libvncserver/auth.c libvncserver/d3des.c libvncserver/main.c libvncserver/sockets.c libvncserver/zlib.c libvncserver/cargs.c libvncserver/draw.c libvncserver/rfbregion.c libvncserver/stats.c libvncserver/zrle.c libvncserver/corre.c libvncserver/font.c libvncserver/rfbserver.c libvncserver/tight.c libvncserver/zrleoutstream.c libvncserver/cursor.c libvncserver/hextile.c libvncserver/rre.c libvncserver/translate.c libvncserver/zrlepalettehelper.c libvncserver/cutpaste.c libvncserver/httpd.c libvncserver/selbox.c libvncserver/vncauth.c x11vnc/*.c; do
echo $x
${CC_GLOBAL} -c ${CFLAGS_GLOBAL} -I. -I../ -I./libvncserver -I./x11vnc -I./rfb -I$INCDIR $x
${CC_GLOBAL} -I .. $LDFLAGS_GLOBAL -o x11vnc/x11vnc *.o -L$LIBDIR -lXinerama -lXtst -lXext -lX11 -lpthread -ljpeg -lz

A binary x11vnc/x11vnc got created, that I copied to /usr/bin.

Step 2: check wi-fi network
My Pi3 has a wi-fi hotspot already setup, as documented here:

...however, for now I am not using dropbear.

Just checking my IP address on the Pi:
# ifconfig

eth0 Link encap:Ethernet HWaddr B8:XX:EB:38:02:BA
inet addr: Bcast: Mask:

Step 3: Run x11vnc daemon
Now, start the x11vnc daemon:
# x11vnc

20/12/2016 20:09:42 Using X display with 32bpp depth=24 true color
20/12/2016 20:09:42 Autoprobing TCP port
20/12/2016 20:09:42 Autoprobing selected port 5900
20/12/2016 20:09:42 screen setup finished.
20/12/2016 20:09:42 The VNC desktop is puppypc13817:0

Step 4: Compile vnc client on laptop
It is confusing, as there are two different products named gvncviewer. One of them is written in Python, requiring py-gtk. There is another written in C, for gtk, and that is what I am using. The latter is a package called 'gtk-vnc', that I downloaded from here:

Unfortunately, I have also read on some websites, the name 'gtk vnc' being used for the Python version. Oh well.

This is how I configured it:
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --with-sasl --without-pulseaudio --with-examples --without-python --with-gtk=2.0 --disable-vala --enable-introspection=no

The "--with-examples" is required, and that will build the 'gvncviewer' binary.

Step 4: Run vnc client on laptop
After installing gvncviewer, it can be run:
# gvncviewer

Yes, up comes the entire Pi3 desktop on my laptop!

Step 5: ssh tunneling?
That would be the obvious next thing, to run dropbear ssh server on the Pi3, and tunnel x11vnc through it.
I am not in any hurry to do it, as I am only doing this on a wi-fi network within my house, well, the signal hardly reaches outside my room. Doing it without an Internet connection.

I have uploaded the x11vnc PET packages (112KB, 118KB):

They have a script, /etc/init.d/zz-x11vnc, which will start x11vnc daemon at bootup. It is a bit crude, waiting 10 seconds for X to start, before starting the daemon.

...oops, have just realised, the line invoking x11vnc inside the startup script, should have an "&" inside it. Will fix.

I am thinking in the future, I might include 'xinetd' in Quirky builds. It is known as a "super server" and is a way of starting other servers on demand. It could be used to start x11vnc and dropbear.

xinetd man page:

Pros and cons of x11vnc
The method that I documented earlier, with ssh daemon running on the Pi3 and ssh client on the laptop, has the great advantage of speed. It uses the X server of the laptop.

X11vnc, on the otherhand, does it all remotely, and it very slow. However, the advantage is seeing the entire desktop.

The ssh-server-client method has an advantage that X does not need to be running on the Pi. This is useful for testing purposes if X is broken on the Pi.


gtk-vnc for x86_64 gtk2   Posted on 21 Dec 2016, 0:02 by admin
The Ubuntu repo does have this, but it is compiled for gtk3.

Here is my PET (113KB):