I recently installed Ubuntu server (including the GNOME desktop) on a new machine which I want to run headless (that is without a monitor). It seems that Ubuntu feels the need to be physically connected to a monitor to properly boot. Without the monitor the system wouldn’t boot or if it did it would be impossible to connect to it using VNC.
After lots of hunting around on the net, here is the solution to running Ubuntu 10.04 without a monitor.
STEP 1 – Edit the /etc/default/grub file and set GRUB_CMDLINE_LINUX=”nomodeset”.
Now the top part of my grub file looks like this:
# If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet" GRUB_CMDLINE_LINUX="nomodeset"
Then update grub from terminal with:
STEP 2 - Create the file /etc/X11/xorg.conf with the following:
Section "Device" Identifier "VNC Device" Driver "vesa" EndSection Section "Screen" Identifier "VNC Screen" Device "VNC Device" Monitor "VNC Monitor" SubSection "Display" Modes "1024x768" EndSubSection EndSection Section "Monitor" Identifier "VNC Monitor" HorizSync 30-70 VertRefresh 50-75 EndSection
STEP 3 – Configure remote desktop access using System->Preferences->Remote Desktop.
Since I am using OS X on the client end, I have to set a password otherwise the built-in VNC client wont’t connect.
STEP 4 – If you have set a password in the step above then you will need to set your keychain password to null. The reason for this is that the Remote Desktop password set in step 3 is store in the keychain. When you connect with VNC, Ubuntu asks you for your password. But since you are on a remote system and don’t have monitor connected you can’t enter the password – catch 22.
Start Applications->Accessories->Password and Encryption Keys. Right-click “Passwords: login” and click “Change Password.” Enter your current user account password and leave the new password fields empty. Click “Use Unsafe Storage.”
STEP 5 – If you haven’t already done so, set the machine to login automatically. Start System->Administration->Login Screen. Click “Unlock” and enter your password if necessary. Click the “Log in as” radio button and select your username.
Reboot – You’re done! Shutdown the machine, unplug the monitor and then reboot. You should be able to connect to the system over VNC without problem.
Warning – This should only be attempted on a secure local area network. Don’t do this on a server exposed to the Internet. By using automatic login then only password protection for your machine is the VNC login, and VNC can be easily hacked. You have been warned!