Install ubuntu on a headless system using PXE and SSH (NetworkConsole)

For installing ubuntu on server machines I had to open the cases for mouting a graphic card for the installation process. I did not want to sit at the server machine for the whole installation process so I searched for a way to do the basic network setup inside the installer and the continue the installation process using a ssh connection (NetworkConsole).

Also I already had a working PXE environment for installing ubuntu, see (german) or (english). So my goal was to combine PXE boot that automatically brings up ubuntu’s NetworkConsole so that I have full control over the installation process.

To transform a normal netboot installation into a netboot that automatically boots the netboot installer and automatically brings up the NetworkConsole you have to modify/add some files:

  • ubuntu-installer/i386/boot-screens/syslinux.cfg: Replace “timeout 0” with “timeout 30” to have a 3 second timeout
  • ubuntu-installer/i386/boot-screens/txt.cfg: Add a new entry:
    label netconsole
    menu label ^Netconsole
    menu default
    kernel ubuntu-installer/i386/linux
    append vga=normal initrd=ubuntu-installer/i386/initrd.gz preseed/url=http://YOUR_DOMAIN/preseed/netconsole.cfg debian-installer/locale=en_US keyboard-configuration/layoutcode=de netcfg/get_hostname=installme
  • ubuntu-installer/i386/boot-screens/txt.cfg: Replace “default install” with “default netconsole”

Changes described above as patch file netconsole.patch

Now place the preseed file (netconsole.cfg) on the webserver you refered above using the following content:

d-i network-console/password           password passwordForSshConnect
d-i network-console/password-again     password passwordForSshConnect
d-i preseed/early_command string anna-install network-console

Yes! That’s all you need here! But addionally I used the following settings to use the german ubuntu archive and take use of my internal proxy:
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string http://dnsname-of-my-squid:3128/


Now boot your machine using PXE be amazed and feel happy! 🙂

How to boot the machine using PXE? There are several ways: You could put iPXE (ROM-Generator)  on a floppy/USB-Stick/USB-Drive/… Anyway: The device containing the PXE boot code has to have a higher priority than your local harddrive in your BIOS’ boot order (otherwise BIOS would try to start from the local harddrive).

A working alternative is a complete full automated installation using a complete preseed file (just use another pressed file).

The easiest way to test these scenarios is to use virtualization software like virtualbox and creating a virtual machine that boots from network (PXE).

Another hint: If you want to use another directory for the ubuntu-installer under tftpboot you have to change all references. You can do that using find and sed, e.g.: find /tftpboot/PXEClient/ubuntu-installer -type f -exec sed -i 's/ubuntu-installer\//ubuntu-installer-netconsole\//g' {} \;

This entry was posted in Linux, Uncategorized, WiFi/Netboot and tagged , , , , . Bookmark the permalink.

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