NSLU2-Linux
view · edit · print · history

OpenDebianSlug is obsolete. Use the DebianSlug firmware and Bootstrap to the official Debian arm little-endian distribution.

Relevant information should be moved from here to the main DebianSlug area.

OpenDebianSlug is the name of a distribution that allows you to run Debian (ARM, big endian) on an unmodified Linksys NSLU2 with no extra hardware required.

If you install Debian on your slug, please add your name to this page.

It is also very important that you install and enable the popularity-contest package so that we can prove we have enough users to enable armeb to become an official Debian supported architecture.

The manual steps required to do this are as follows:

  1. Install OpenSlug and turnup init as usual.
  2. Attach your external storage, partition and format it (make sure you include a swap partition).
  3. Mount the external storage root partition as /mnt, in this example we use /dev/sda1: mount /dev/sda1 /mnt
  4. Fetch the pre-built rootfs and put it on the drive:
    cd /mnt ; wget http://ftp.armeb.net/other/rootfs/nslu2-sarge-0.2.tar.gz
  5. Extract it:
    tar zxf nslu2-sarge-0.2.tar.gz
    mv nslu2-sarge-0.2/* .
    rmdir nslu2-sarge-0.2
    [beewoolie] If you end up using a tar other than the busybox version, you may encounter some warnings about the time stamps being in the future. You can suppress these warnings by adding the 'm' switch to the tar command: tar zmxf and so on.
  6. Copy the Openslug kernel modules to the Debian tree:
    cp -Ra /lib/modules/* lib/modules
    cp /etc/modprobe.conf etc
  7. Edit /mnt/etc/fstab, /mnt/etc/network/interfaces and /etc/mailname (see below for examples).
  8. Copy the existing /etc/resolv.conf, /etc/hosts, /etc/hostname and /etc/defaultdomain (should be present) from Openslug:
    cp /etc/resolv.conf etc/resolv.conf
    cp /etc/hosts etc/hosts
    cp /etc/hostname etc/hostname
    cp /etc/defaultdomain etc/defaultdomain
  9. Mount proc on /mnt/proc in order to be able to use the network:
    mount -t proc proc /mnt/proc
  10. Chroot to the external drive to make changes to it using Debian programs:
    cd /
    chroot /mnt
  11. Edit /etc/apt/sources.list (see below) to use the http://ftp.armeb.net/debian repository.
    comment out the current repositories by adding a # in front of them
    then add: deb http://ftp.armeb.net/debian sarge main
    use "deb http://ftp.armeb.net/debian sid main contrib override" for unstable repository
  12. Get the latest package list, upgrade and install SSH for login:
    apt-get update
    apt-get dist-upgrade
    apt-get install anacron popularity-contest
    apt-get install ssh
    (Note that this will generate new ssh host keys, replacing the ones that OpenSlug's ssh was using, which will make your ssh client complain when you reconnect later.)
    [PP:] Upgrading might result in all manner of processes running from /mnt that need to be killed later!! You might just choose apt-get update followed by apt-get install ssh and do the upgrades and installing anacron + popularity-contest after rebooting.
  13. Set the root password so you can get in when you SSH into it after reboot: passwd
  14. Go back to flash rootfs: exit
  15. Unmount proc from /mnt: umount /mnt/proc
  16. Unmount the drive so the next command will work: umount /mnt
    [Joakim] I had to kill the running anacron process, started earlier by the apt-get install anacron command, for the umount to be successful. [PP:] I also had to kill syslogd and klogd. [MVM:] I also had to kill the exim4 process.
  17. Make external drive rootfs on startup: turnup disk /dev/sda1 -t ext3 (or turnup memstick with the same args if you're using a USB flash device)

    (Note: be sure to have the system clock set right, the boot will fail if it's wrong).
    (As an example, to set the current time and date to July 31, 11:16pm, type ``date 07312316 (note that the time is given in 24 hour notation). If you wanted to change the year as well, you could type ``date 073123161998. )

    (Note2: The problem seems to be in the hwclock command, which apparently can hang during boot.
    Maybe it's related to this: http://www.nslu2-linux.org/wiki/HowTo/FixTheClockUsingAdjtimexAndNtpclient
    Anyway, if manually setting the date doesn't help (box won't boot, no ping reply), reboot it without the hard disk attached,
    ssh into the system, reattach the drive, mount it and move the respective start/stop scripts
    out of the way, e.g. by changing the filenames to start with a lowercase letter.
    # mv /mnt/etc/rcS.d/S18hwclockfirst.sh /mnt/etc/rcS.d/s18hwclockfirst.sh
    # mv /mnt/etc/rcS.d/S50hwclock.sh /mnt/etc/rcS.d/s50hwclock.sh
    # mv /mnt/etc/rc0.d/K25hwclock.sh /mnt/etc/rc0.d/k25hwclock.sh
    # mv /mnt/etc/rc6.d/K25hwclock.sh /mnt/etc/rc6.d/k25hwclock.sh
    You will likely want to set up something like ntpd or an ntpdate command through a crontab entry later. )
  18. Reboot the system to start Debian: shutdown -r now
  19. Upon startup of debian, SSH into it and start installing...

Comment:The SLUg? status light will continue to flash until you perform dpkg-reconfigure exim4-config, so if you can't ssh straight away, give it a moment to finish booting

  1. Run tzconfig to set up the proper timezone (UT by default)
  2. Make sure you reconfigure exim4:
    dpkg-reconfigure exim4-config
  3. Report the existence of your new armeb Debian machine:
    /etc/cron.weekly/popularity-contest
    You can read more on the Debonaras wiki

Upgrading from a working OpenSlug to OpenDebianSlug

If you are converting from a working OpenSlug (with external disk root file system) to OpenDebianSlug and want to keep your data: Follow my amended instructions bellow:

Before you start it can be wise to do ipkg list_installed > mylist on the openslug to get a list of what programs to install once you have OpenDebianSlug up and running...
Step 1: You can skip turnup init as this has already been done.
Step 2: If you don't have a swap partion I recommend setting up a swap file (See step 11).
Step 3: To avoid your old openslug interfering with the debian root file system, I recommend moving all folders to a backup directory (and you can reuse some of your config files... :-)
Follow step 3
cd /mnt; mkdir backup
mv -r <dirname> backup/
You may leave the "home" dir and disregard the error message: mv: unable to rename `nslu2-sarge-0.2/home': Directory not empty. The rest of the files will be moved.
Step 7:
cp backup/etc/fstab etc/fstab
cp backup/etc/network/interface etc/network/interface
I didn't change etc/mailname.
Step 8: Use the files from your backup directory:
cp backup/etc/resolv.conf etc/resolv.conf
cp backup/etc/hosts etc/hosts
cp backup/etc/hostname etc/hostname
cp backup/etc/defaultdomain etc/defaultdomain
Step 11: Before you do step 11 we can setup a swap file if you don't have a swap partion. dd if=/dev/zero of=/var/swapfile bs=1024 count=131072 (creates a 128 mb file)
mkswap /var/swapfile
swapon /var/swapfile (Uses the file as swap :-)
edit/ create /etc/init.d/swapfile:

 #!/bin/sh
case "$1" in start) echo "* Starting swapfile..." swapon /var/swapfile echo "done." ;; stop) #Don't know if you need to stop it on shutdown... #echo "* Stoping swapfile..." #swapoff /var/swapfile #echo "done." ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac exit 0

ln -s /etc/init.d/swapfile /etc/rcS.d/S100swapfile (starts swap at boot)
13: Before we exit we need to turn off the swap
swapoff /var/swapfile
Continue with step 13
God luck!

Installing the root filesystem on NFS

You can also boot Debian from an NFS share. This can be useful for experiments and for diskless operation. You don't need to attach any disks to the slug, but you will need an NFS server, of course.

We assume the NFS server is nfs.example.org.

On the NFS server:

  1. Fetch the pre-built rootfs (see above).
  2. Extract it somewhere, let's say in /fs/slug.
  3. Add an entry for /fs/slug to /etc/exports, giving the slug read-write access. You need the no_root_squash option.
  4. Tell NFS to reload its configuration:
    exportfs -r
    or, on Debian systems:
    /etc/init.d/nfs-kernel-server reload
  5. Customize fstab, network/interfaces, mailname, resolv.conf, hosts, hostname and defaultdomain in the /fs/slug/etc directory (see below for examples). Note that the first line of fstab should now read something like:
  nfs.example.org:/fs/slug      /      nfs   defaults        0 0
  1. Edit etc/apt/sources.list to use the debonaras.org repository.

On the slug:

  1. Install OpenSlug and turnup init as usual.
  2. Mount the root filesystem:
    mount -o nolock nfs.example.org:/fs/slug /mnt
    I have found the nolock option to be necessary, possibly because OpenSlug does not have rpc.statd.
  3. If you will want to have a swap file over NFS (you probably will), install the loop kernel module. You need to get the package file and install it. e.g.:
    wget http://ipkg.nslu2-linux.org/feeds/openslug/cross/2.7-beta/kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
    ipkg install kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
    rm install kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
  4. Copy the Openslug kernel modules to the Debian tree:
    cd /mnt
    cp -Ra /lib/modules/* lib/modules
    cp /etc/modprobe.conf etc
  5. Mount proc on /mnt/proc in order to be able to use the network:
    mount -t proc proc /mnt/proc
  6. Chroot to the NFS root:
    chroot /mnt
  7. Get the latest package list, upgrade and install SSH for login:
    apt-get update
    apt-get dist-upgrade
    apt-get install anacron popularity-contest
    apt-get install ssh
    Note that this will generate new SSH host keys.
  8. Set the root password:
    passwd
  9. Go back to flash rootfs: exit
  10. Unmount proc: umount /mnt/proc
  11. Unmount the NFS share: umount /mnt
  12. Make the NFS share be the root filesystem on startup:
    turnup nfs nfs.example.org:/fs/slug
  13. Boot Debian: reboot

From here, follow the rest of the procedure for the disk-based install.

Some info on use:

  • With Putty as SSH client, you can use xterm-color instead of xterm-pcolor as terminal type.
  • Copy the LED-program to Debian and make the LED device: cp /initrd/sbin/leds /sbin; mknod /dev/leds c 126 0; chmod 660 /dev/leds (this will later be supplemented by the use of LED settings in the startup scripts). Try experimenting by typing leds and see the power LED go from blinking yellow to steady green.
  • To make the leds react to changes in runlevels, copy the init scripts and update the runlevel links:
    cp /initrd/etc/init.d/zleds /initrd/etc/init.d/leds_startup /etc/init.d/
    update-rc.d zleds defaults 99 05
    update-rc.d leds_startup defaults 01
  • If installing proftpd with xinetd, create the file /etc/xinetd.d/proftpd with the content:
 #
 # ProFTPd FTP daemon - http://www.proftpd.org
 #
 service ftp
 {
       flags            = REUSE
       socket_type      = stream
       instances        = 30
       wait             = no
       user             = root
       server           = /usr/sbin/proftpd
       server_args      = --config /etc/proftpd.conf
       log_on_success   = HOST PID
       log_on_failure   = HOST
       disable          = no
 }
  • Rather than the package repository announced by Lennert, you should now use ftp.armeb.net. Edit the file /etc/apt/sources.list to look like:
 deb http://ftp.armeb.net/debian sarge main
  • To power down the slug by using the power button you have to change the /etc/inittab file (otherwise the system will only be rebooted):
    Replace the line
    ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    by
    ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now

Some working config files

/etc/fstab

I have divided my disk into 2 partitions: root (~10GB) and swap (256MB). Just add further data partitions:

 /dev/sda1       /               ext3    defaults        1  1
 /dev/sda2       swap            swap    defaults        0  0
 proc            /proc           proc    defaults        0  0
 usbfs           /proc/bus/usb   usbfs   defaults        0  0

/etc/network/interfaces

In general, since you could wget the OpenDebianSlug rootfs, you know your Openslug network setting are correct. You can then just copy the /etc/network/interfaces file from OpenSlug and insert the following lines after the line starting with "iface eth0 inet" (make sure you copy in your own ethernet MAC address from the sticker on the bottom of your slug):

        pre-up modprobe -f ixp425_eth
        pre-up modprobe -f ixp400
        pre-up ifconfig eth0 hw ether 00:04:5A:XX:YY:ZZ

debootstrap

For debootstrapping your debian from an already flashed openslug, have a look at Debonaras wiki

Cross-compilation

If you want to cross-compile programs for your OpenDebianSlug, see CrossCompiling.

Or if you wish to leverage the native configure environment with the speed of CrossCompiling, see UseDistCCWithCrossCompiler .

Printing

Printing to a USB printer using CUPS is described on the Printing page. A similar approach will be required for other tasks that need additional kernel modules.

Page last modified on February 15, 2007, at 11:38 AM