Headless X on Kubuntu 12.10

I have a new machine that I’m setting up to a be a renderer. This machine will sit happily in the corner without monitor / keyboard / mouse and render video clips. The problem is: how on earth do you setup Ubuntu to boot without a monitor.

Step 1: BIOS

Go into the BIOS and make sure it doesn’t try to warn if there are no input devices or monitors attached. While here it is probably a good idea to configure the machine to auto boot on power failure, and if possible set it to wake on LAN.

Step 2: Xorg

This took a while to chase down since Ubuntu no longer really uses xorg.conf. What I ended up doing was running nvidia-settings and then hunted around for a button “Aquire EDID”. The file it generated I then copied over to /etc/X11/ and then I used this xorg.conf file I found.

 Section "Monitor"
    Identifier     "Headless"
 EndSection

 Section "Device"
    Identifier     "NVIDIA Corporation NVIDIA Default Card"
    Driver         "nvidia"
    Option         "ConnectedMonitor" "DFP-1"
    Option         "CustomEDID"       "DFP-1:/etc/X11/edid.bin"
 EndSection

 Section "Screen"
    Identifier     "Default Screen"
    Device         "NVIDIA Corporation NVIDIA Default Card"
    Monitor        "Headless"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes       "1920x1080"
    EndSubSection
 EndSection

This is based on one of my work desktop monitors and so the Modes section should be changed to match whatever monitor the edid.bin file came from.

Step 3: VNC

In order to connect with a GUI setup a VNC client and optionally setup autologin. In my case I installed x11vnc and followed these directions to get x11vnc server running. In summary

  • Install x11vnc
  • Create /etc/init/x11vnc.conf
  • Reboot

So far this doesn’t quite work for me. I can run the script manually from ssh but I’m missing something.
Here is the script:

start on login-session-start
script
/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
end script

Step 4: Connect

Easy step. Krdc comes installed on Kubuntu so I just fired this up and connected to the server. Hopefully at this point everything works fine.

Step 5: Always boot

Because this setup is headless if the machine prompts at bootup for whatever reason you’re going to have a hard time figuring out what is happening. In my case the machine doesn’t store any critical data so I’m happy to have it go ahead and try to fix up issues on its own.

  • Allow auto fsck for disk errors. Edit /etc/default/rcS and change FSCKFIX to yes
  • Set grub record fail to something > 0. Edit /etc/default/grub and add GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT

For reference I found these sites rather helpful:

Loading Facebook Comments ...

Leave a Reply

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