Monday, June 22, 2009

Ubuntu Server on a Soekris

I've been running the remnants of the non-hosted portions of spoofed.org on an older small form factor computer in a closet for almost two years now. In addition to being a Debian install from ~2006, the box was generally quite a waste and all it really did was make heat, suck power and buzz its fans.

So, this weekend I took a few hours and installed Ubuntu 9.04 (Jaunty Jackalope) Server on one of my trusty Soekris 4801s.

There is plenty of documentation out there that either describes a similar process using significantly older versions of Ubuntu, or involves unnecessarily complicated methods of achieving the same end. Following on a entry I did a few years ago on installing OpenBSD on a Soekris, I once again took the route of using qemu to aid in installation.

OK, lets cut to the chase.

  1. Download the Ubuntu Server ISO
  2. Remove the CF or 2.5" disk from your Soekris and plug it in to the system you'll be doing the install on. Take note of what device it gets assigned -- my 2.5" laptop drive got /dev/sdd.
  3. Fire up qemu. Change your memory (512), hard disk, and cdrom options as necessary. Note that the -no-acpi option is necessary to get the installer to start:
    sudo /usr/bin/qemu  -m 512 -boot d -hda '/dev/sdd' -cdrom  '~warchild/ubuntu-9.04-server-i386.iso' -net nic,vlan=0 -net user,vlan=0 -localtime -no-acpi
    
  4. Install as you normally would.
  5. After the install has finished, halt qemu and restart, booting directly off your new Ubuntu installation instead of the ISO:
    sudo /usr/bin/qemu  -m 512 -hda '/dev/sdd' -net nic,vlan=0 -net user,vlan=0 -localtime -no-acpi
    
  6. Optional: if your Soekris does not support PAE -- the Geode processors used in the 48xx and 45xx certainly do not -- you'll need to install a kernel that does not require PAE. The kernel that ships with Jaunty Server -- 2.6.28-11-server -- requires PAE. You can either recompile and remove that requirement, or take the easy/easier route and just install the generic kernel
    sudo apt-get install linux-image-generic
    
  7. Reconfigure the your system to spawn a login shell on the serial port. Put the following in /etc/event.d/ttyS0:
    start on runlevel 2
    start on runlevel 3 
    start on runlevel 4 
    start on runlevel 5 
    stop on runlevel 0
    stop on runlevel 1 
    stop on runlevel 6
    respawn
    exec /sbin/getty 115200 ttyS0
    
  8. Somewhere towards the top of /boot/grub/menu.lst, ensure that the following two lines are present. The first just configures the serial port (change speed if necessary), and the second configures terminal I/O to be on that serial port:
    serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
    terminal --timeout=5 serial
    
    Next, find the commented out section of /boot/grub/menu.lst that defines defoptions. Leave it commented out, but append the console directive to tie all this serial goodness together:
    # defoptions=splash console=ttyS0,115200
    
    Now, run update-grub to regenerate menu.lst :
    $  sudo update-grub        
    Searching for GRUB installation directory ... found: /boot/grub
    Searching for default file ... found: /boot/grub/default
    Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
    Searching for splash image ... none found, skipping ...
    Found kernel: /vmlinuz-2.6.28-13-generic
    Found kernel: /vmlinuz-2.6.28-11-server
    Found kernel: /memtest86+.bin
    Updating /boot/grub/menu.lst ... done
    $  sudo grep console /boot/grub/menu.lst
    # defoptions=splash console=ttyS0,115200
    # xenkopt=console=tty0
    kernel  /vmlinuz-2.6.28-13-generic root=UUID=f48b39a6-020d-46e6-b25d-9210472ba1fd ro splash console=ttyS0,115200 
    kernel  /vmlinuz-2.6.28-11-server root=UUID=f48b39a6-020d-46e6-b25d-9210472ba1fd ro splash console=ttyS0,115200 
    
  9. As a last step before you boot your Soekris, it probably wouldn't hurt to update:
    sudo apt-get update && sudo apt-get -u upgrade
    
  10. Halt your Ubuntu host running in qemu, remove the disk and install it in your Soekris
  11. Now, configure your Soekris so that it'll jive with the serial settings you just configured in Ubuntu. Unless you have already changed it, your Soekris will (likely) come from the factory with its serial port configured at 9600n81. Configure your favorite serial communication program (minicom) to 9600n81, connect your null-modem serial cable to your Sorkris and host system, and then power on the Soekris. Press ctrl-p to get to the Soekris prompt. Set ConSpeed to 115200 (or whatever you configured your kernel to above):
    set ConSpeed 115200
    
    Now your Soekris will be speaking at 115200, so reconfigure your serial communication program as necessary.
  12. Ensure that the boot order is correct (show BootOrder). If it does not begin with 80 81, 81 80 or something similar, use set BootOrder to remedy that. Remember, 80 is the CF, 81 is the first IDE device if present.
  13. Type 'boot'
  14. Enjoy.

2 comments:

Anders Bandholm said...

The factory default for a Soekris is actually 19200 bps. I know this for a fact for the net5501, but the wiki claims that this is general: http://wiki.soekris.info/Connecting_to_the_serial_console

선화 said...

I successed all processes, but after boot command, minicom is only displaying the message, "GRUB loading, please wait..."
My soekris board is 5501.
Does your method support 5501 board?