Ubuntu 9.04 Server Installation via debootstrap on a Soekris net4801

peewee@kids-these-days.org

 

These instructions describe how I installed Ubuntu 9.04 on my 256MB Soekris net4801 by using debootstrap to build a CF card on a host system running Ubuntu 9.04. I tried using an Ubuntu 9.10 for the host system but was unable to get Grub properly configured. I gave up and used a 9.04 host.

There are older docs on the Ubuntu Wiki available on how to install Ubuntu on a Soekris via PXE but the Soekris is the PXE server on my home network so I prefer an alternate method of installation. I did borrow a few steps from the Ubuntu document.

I assume that you have a working knowledge of Debian like Linux systems and of Linux in general. Commands beginning with sudo are to be run on the host system while others are to be run as root inside the chroot.

I run my serial console at 9600 baud.


  1. Partition the CF card and mount the target / filesystem at /mnt/target. I use one large root partion and add some swap. There is some concern that allocating swap on a CF card will cause significant write activity and shorten the lifespan of the card. I only run the ISC dhcpd, Bind, ntpd and a couple of shell sessions so I fit into my 256MB of RAM easily and the swap is just a saftey net. If you want something different, adjust accordingly. Also, buy good CF cards with write leveling.
    sudo mkdir /mnt/target
    sudo cfdisk /dev/sdb # I put swap in sdb5 and the rest of the CF card into sdb1
    sudo mke2fs -j /dev/sdb1
    sudo mkswap /dev/sdb5
    sudo mount /dev/sdb1 /mnt/target
    
  2. Mount the installation ISO. You can use any network mirror in the next step if you don't want to download the ISO - see debootstrap(8) for more information.
    sudo mkdir /mnt/iso
    sudo mount -t iso9660 -o ro,loop=/dev/loop0 /temple/sw/linux/ubuntu-9.04-server-i386.iso /mnt/iso
    
  3. Run debootstrap:
    sudo apt-get install debootstrap
    sudo debootstrap --arch i386 jaunty /mnt/target file:/mnt/iso
    
  4. Chroot into the target:
    sudo chroot /mnt/target /bin/bash
    
  5. Make /etc/fstab. I don't use UUIDs for the partitions on my Soekris but if you do, make sure that the correct one winds up in your /boot/grub/menu.lst below.

    Note that I use a tmpfs for /tmp. You may not want that.

    # file system   mount point     type    options                 dump    pass
    /dev/sda1       /               ext3    defaults                0       0
    /dev/sda5       none            swap    sw                      0       0
    tmpfs           /tmp            tmpfs   size=128m,mode=1777     0       0
    proc            /proc           proc    defaults                0       0
    sys             /sys            sysfs   defaults                0       0
    
  6. Mount virtual filesystems:
    mount /proc
    
  7. Configure the console. I just went with the defaults.
    dpkg-reconfigure console-setup
    
  8. Setup networking:
    editor /etc/network/interfaces
    
  9. set hostname:
    echo pathos > /etc/hostname
    
  10. Setup a nonroot user:
    adduser foo
    echo 'foo ALL=(ALL) ALL' >> /etc/sudoers
    chmod 0440 /etc/sudoers
    
  11. Setup /etc/apt/sources.list, /etc/hosts and /etc/resolv.conf.

  12. Create the file /etc/event.d/ttyS0 with contents:
    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 -L ttyS0 9600 vt102
    
  13. Install a kernel and configure grub. debootstrap will not install a bootloader for you.

    apt-get install linux-image-generic grub memtest86+
    
    cd /dev
    MAKEDEV sd
    
    mkdir -p /boot/grub
    update-grub
    editor /boot/grub/menu.lst
    
    Make the following changes to the menu.lst:

    1. Below the timeout, add a stanza for the serial console:
      ## timeout sec
      # Set a timeout, in SEC seconds, before automatically booting the default entry
      # (normally the first entry defined).
      timeout         3
      
      ###############################################
      ## Serial/Console setup
      ###############################################
      # Setup serial (COM1) here with baudrate 9600
      # use --unit=1 (for COM2) and so on
      serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
      
    2. Add the serial console to the kopt line:

      # kopt=root=UUID=fb808f9c-7f57-41e8-b969-4268bdf69767 ro console=ttyS0,9600

    3. Run update-grub again to update the automagic kernel entries with the serial console.

  14. Edit the file /etc/initramfs-tools/modules and add the following two lines at the end of the file:
    ext3
    ide_generic
    Now, you have to update your initramfs with
    update-initramfs -u
  15. Install grub on the MBR:
    umount /proc
    # exit the chroot()
    exit
    
    # Run this from outside the chroot()
    sudo grub-install --no-floppy --root-directory=/mnt/target /dev/sdb1
    
  16. Install the CF card in the Soekris and boot. At this point, you should have a working but very minimal Ubuntu system. You should be able to login via the serial console as user foo with the password that you fed to adduser and from there sudo to root.

  17. Do whatever you need to do to install your applications and configuration data. Personally, I use slack and Puppet.


$Id: ubuntu_net4801.html 11 2009-12-15 03:29:42Z peewee $