Tuesday 11 May 2010

HOWTO: Install a Soekris server with PXE Boot

The Soekris NETxxxx boards can't boot from CDROM or USB, so installing an operating system requires PXE booting from the network, unless you want to prepare the hard disk or CF card in another machine first.  Another challenge is that the Soekris boards only have a serial console, so you can't use an operating system that assumes a video display and keyboard.  This article outlines your options.

You can use PXE Boot for a wide variety of purposes. My motivation on this occasion was to write a new image the CF card that my Soekris NET5501 AskoziaPBX Asterisk server boots from, without having to unbolt the server from the rack.

To install a full FreeBSD system, see :-

    http://jdc.parodius.com/freebsd/pxeboot_serial_install.html
    http://wiki.soekris.info/Installing_FreeBSD
    http://wiki.soekris.info/Installing_FreeBSD#Patch_for_PATA_hard_disk_errors_on_FreeBSD_7.x

To install other operating systems, see:-
     http://wiki.soekris.info/Main_Page#Operating_Systems .

To load an embedded "appliance" distribution (Monowall, pfSense, AskoziaPBX, FreeNAS?) the procedure is much simpler, and should only take a couple of minutes.  During installation, we'll use a special-purpose LiveCD to avoid having to configure anything by hand, with a standalone Ethernet cable to avoid conflicts with existing network configurations.

Prerequisites:
  • Working serial console access to the Soekris computer (9600-N-8-1 with no handshaking).
  • A temporary PC or a VMware server, to boot a LiveCD as your PXE server.
  • An Ethernet cable from the LiveCD PXE server to the first Ethernet port on the Soekris.
  • A USB memory stick containing the image you want to install to the Soekris. 
NOTE: The USB stick isn't essential. If you don't have physical access to the Soekris, you can save your image to the Voyage VM beforehand if you assign it an IP address compatible with your network.  You can usually reset or power-cycle the Soekris 5501 via a serial console connection using its ILO feature: type '+++', wait 1 sec, 'reset(return)' to reset; '+++', wait 1 sec, 'power(return)' to power-cycle.

Procedure:
  • Download the Voyage Linux Live CD ISO from http://linux.voyage.hk.  (I used 0.6.5.)
  • Boot the Live CD on a spare PC, or under VMware.  Use a standalone network (e.g. just one Ethernet cable) because Voyage Linux will start its own DHCP and TFTP servers.
  • Login to the Live CD system: user "root", password "voyage".  Execute the commands: 
        remountrw
                   [Optional: To change the IP address range: vi /etc/dnsmasq.pxe.conf /etc/exports /etc/init.d/voyage-pxe /tftpboot/pxelinux.cfg/default and change 192.168.1.  Do not reboot! The changes are volatile! ]
        /etc/init.d/dnsmasq restart
        /etc/init.d/voyage-pxe start
Start the Soekris machine. When prompted, type Control-P to enter the ComBIOS monitor.  Now type: 'boot f0' (that's f, then zero) to begin the PXE Boot process.
  • Keep an eye on the Soekris serial console.  After the Linux kernel has booted, if you're lucky you'll get a login prompt.  Log in as user "root", password "voyage".
  • If instead of a login prompt, you get repeated "mount call failed: 13" errors, just wait for a minute.  You will be dropped into a BusyBox shell with the prompt "(initramfs)", which is good enough for most purposes.
  • Now plug the USB memory stick into the Soekris PC.
  • Use this command sequence to load the image onto the Soekris (your mileage may vary slightly) :-
            mkdir /tmp/usb
            mount -t vfat /dev/sda1 /tmp/usb
            dd if=/tmp/usb/fred.img of=/dev/hda bs=16k
This assumes that your .img file has already been decompressed using gzip.  If not, you should be able to get away with "gzip -dc /tmp/usb/fred.img >/dev/hda" although this will be a bit slow.

You may need to tweak the /dev entries to match your hardware, depending on the type of disks you have.  It may be helpful to use the 'ls' command to check for /dev/hd* and /dev/sd* before you plug in the USB memory stick, so that you can be sure which device is which.  For example the hard disk may be /dev/hdb on some systems.

1 comment:

  1. Excellent documentation. Works like a charm. THANK YOU.

    ReplyDelete

Spammers: please stop wasting my time. All comments are moderated before publication.