Installing Debian Squeeze on a headless Soekris, using debootstrap

November 2011


PXE doesn't always work, and it requires some work to set up. If you're not doing many installs (more than one), then debootstrap can be used...

  1. Mounting the Solid State Disk on a Lucid box

    I have a Linux machine with 64-bit Ubuntu Lucid. The Soekris (a net5501) is 32 bit, but that's no problem. I put the SSD CIFS card in a card reader and edit the partition table to look like:

    [Warning]Warning

    Of course, you shouldn't make the beginners' mistake of editing the wrong device here. If you happen to think the SSD card is on /dev/sda, chances are that you don't know what you are doing. Think again.

    As you see, we use a single partition for the system, and a small one for swap.

  2. Put a filesystem on the device

  3. Use debootstrap to prepare most of the Debian Squeeze

  4. Bindmount /dev into the newly built system

    This is only needed for installation of GRUB several steps later, but we do it now so we don't have to exit the chroot then.

  5. Fix a few things

  6. Install a kernel (and headers)

  7. Create an MBR

    [Note]Note

    Make sure that the boot parameter console=ttyS0,115200 is appended to any kernel line. Otherwise, you won't be able to log in.

    [Warning]Warning

    The device to put a master boot record on is /dev/sdd in my case. But the disk of my Lucid machine is also still visible. Remember that we bindmounted /dev/ into the chroot? You almost certainly don't want to put a new MBR in /dev/sda. If you do make a mistake, you may render the machine you're working on unbootable.

  8. Make GRUB use the serial console too

    Make absolutely sure that the line GRUB_CMDLINE_LINUX="console=ttyS0,115200" is in /etc/default/grub:

    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    
    GRUB_DEFAULT=0
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT=""
    GRUB_CMDLINE_LINUX="console=ttyS0,115200"
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    #GRUB_GFXMODE=640x480
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_LINUX_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    	

    Now GRUB make Linux use the serial console, but GRUB itself needs to use the serial console as well. That's configured in /etc/grub.d/00_header:

    function load_video {
    EOF
    if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
      cat <<EOF
    insmod ${GRUB_VIDEO_BACKEND}
    EOF
    else
      # Insert all available backends; GRUB will use the most appropriate.
      for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
          cat <<EOF
    insmod ${backend}
    EOF
      done
    fi
    cat <<EOF
    }
    
    # These three lines added -Apprentice
    serial --unit=0 --speed=115200
    terminal serial
    
    EOF
    <snip>
    	

    Now run update-grub and you should be fine.

  9. Unmount the SDD

  10. Put the SDD card in the Soekris box

    ... and power it up. This should get you a running Soekris.

  11. Fix the names of the network interfaces.

    the file /etc/udev/rules.d/70-persistent-net.rules generated when debootstrap ran doesn't contain the NICs of the Soekris, and when the Soekris is booted, there will be no eth0. Edit said file and give the right name to the right MAC address, then reboot.

    <snip>
    #commented-out, is from debootstrap# ## PCI device 0x8086:0x10ef (e1000e)
    #commented-out, is from debootstrap# #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="f4:ce:46:30:14:b2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    # PCI device 0x1106:0x3053 (via-rhine)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:ca:65:d4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    # PCI device 0x1106:0x3053 (via-rhine)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:ca:65:d5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
    
    # PCI device 0x1106:0x3053 (via-rhine)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:ca:65:d6", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
    
    # PCI device 0x1106:0x3053 (via-rhine)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:ca:65:d7", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
    
    
    # PCI device 0x100b:0x0020 (natsemi)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:c9:b0:10", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"
    
    # PCI device 0x100b:0x0020 (natsemi)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:c9:b0:11", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"
    
    # PCI device 0x100b:0x0020 (natsemi)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:c9:b0:12", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth6"
    
    # PCI device 0x100b:0x0020 (natsemi)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:c9:b0:13", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth7"
    	

    You could've done this before putting the SSD in the Soekris, if you knew the MAC addresses beforehand...

  12. Install some software

    If PostgreSQL doesn't run, maybe put in /etc/postgresql/8.4/main/postgresql.conf a line:

    listen_addresses = '*'
    	

    Then (re)start the server and create the OpenERP database:

    Now install OpenERP, and sshd too:

    [Note]Note

    You may have to comment out

    'interface = localhost'

    in /etc/openerp.conf and restart the daemon.