Inovato Quadra Headless VNC

VNC on a headless system sounds like an odd choice, and indeed, for most things I need this box for I will be connecting via ssh and have no need for a graphical interface. Since I don’t have the HDMI port connected to anything, there is even more reason to just turn it off as the default resolution without a monitor connected turned out to be a measly 1024×768 (yes, I am old enough to remember when that was a good screen resolution, but that’s no longer the case).

There are a few possible solutions to this problem:

  • Connect a monitor 🤣
  • Plug in a dummy monitor HDMI plug
  • Switch from the default Xorg server to Xvfb

Connecting a monitor Is not an option for my purposes, and I don’t have any of the HDMI dummy monitor plugs, so that left the third option: running Xvfb (vfb = virtual frame buffer) instead of the default Xorg server.

Switching to Xvfb

The Quadra comes with Armbian installed on it, and that uses LightDM as its display manager. The latest firmware also supports auto-login (so the box basically wakes up at a desktop). LightDM is a systemd service that also takes responsibility for launching the X server process.

In the /etc/lightdm/lightdm.conf file there is an option to change the command used to launch the X server, but unfortunately, it doesn’t extend to the options passed to the command. My Quadra was using this command line to launch the Xorg server:

/usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

The problem there is that the Xvfb server does not like all those options. Instead, I created a simple wrapper script, /root/startxvfb, and gave that as the command to start the X server in the lightdm.conf file.

#!/bin/sh

exec Xvfb :0 -screen 0 1920x1080x24

I could have done something more sophisticated and parsed the arguments from that list, passing through any that were needed, but for this very specific system, simpler was better, so I totally ignore any of the arguments passed in by lightdm and launch Xvfb just how I want it.

The two lines that need to change in the lightdm.conf file are:

@@ -93,6 +93,7 @@
 #pam-greeter-service=lightdm-greeter
 #xserver-backend=
 #xserver-command=X
+xserver-command=/root/startxvfb
 #xmir-command=Xmir
 #xserver-config=
 #xserver-layout=
@@ -117,7 +118,7 @@
 #session-wrapper=lightdm-session
 #greeter-wrapper=
 #guest-wrapper=
-display-setup-script=/usr/share/lightdm/lightdmxrandr.py
+#display-setup-script=/usr/share/lightdm/lightdmxrandr.py
 #display-stopped-script=
 #greeter-setup-script=
 #session-setup-script=

That gets me a 1920×1080 desktop, but no way to see it…

Adding VNC

While the forums are all in favor of NoMachine, and there are certainly some great reasons to use it if you need remote access to your system’s desktop, for my LAN-only requirements VNC is perfect. Even better, my Mac computers already have a VNC viewer in them (the Mac Screen Sharing app is a VNC client), so no additional software needed on my Mac.

So, I installed the x11vnc package, and then discovered that it was not quite right for what I wanted. If I started it manually, it would work. I could configure an ssh session to launch it (and forward the port over the tunnel as well), which would be ideal if I was on an untrusted network, but for my own LAN all I needed was for the VNC server to start on boot and be there ready for me when needed.

I made some changes to the /etc/systemd/system/x11vnc.service file to launch the VNC server correctly, and also to make it launch after Light DM and be part of the multi-user target group so it could be enabled to run on boot. The final version of the file looks like this:

[Unit]
Description=x11vnc remote desktop server
Wants=network-online.target
After=network-online.target
After=lightdm.service

[Service]
ExecStart=/usr/bin/x11vnc -ncache_cr -geometry 1920x1080 -rfbauth /etc/vnc.passwd -display :0 -no6 -many -auth /var/run/lightdm/root/:0
Restart=on.failure

[Install]
WantedBy=multi-user.target

Interesting note: the -ncache 10 option that was in the default line (and was recommended by the copious output that x11vnc generates if you run it from the command line) did not work well with the Apple screen sharing client. I ended up with a very, very tall, thin window on my Mac. Removing that, or switching to -ncache_cr fixed that problem.

Adding.a Password

Some clients (the Apple one included) do not like connecting to servers that have no password. While you can set one on the command line of x11vnc, that’s really not a great idea. Instead, the command above included a reference to /etc/vnc.passwd as the file where the VNC password could be found. To generate that, since it is hashed, x11vnc has a special option:

sudo x11vnc -storepasswd /etc/vnc.passwd

That will prompt for the password (twice) and then ask to confirm the write to the specified file. Once that is done, your VNC session will have a password.

Enabling It

Once the changes are made, you will want to enable both services and start them both (enabling is what allows them to run on reboot, but will not start them if they are not already running). Assuming LightDM is already running with the default configuration, you will need these commands:

systemctl daemon-reload
systemctl restart lightdm.service
systemctl enable lightdm.service
systemctl start x11vnc
systemctl enable x11vnc

That should get you everything you need to be able to launch your VNC viewer on another machine and see something like this:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.