Installation of Debian 5.0 (lenny) on linksys NSLU2

Ok, for anyone who wondered why my site has been down for 8 days and for those who want to install armel on NSLU2, here are my installation notes.

On Saturday last I intended to install armel (Debian 5.03), a task I assumed would take 4-12 hours. Because this is a very low volume site I did not mind that this task would mean being offline for the entire time. How wrong I was.

I did a little googling and settled on instructions on Martin Michlmayr's site. I started by backing up my data and then writing out my installed packages with dpkg --get-selections > file in effect partially following these instructions. So after downloading from I unzipped and used upslug2 to write to flash. Everything fine.

Then I ran into my first problem. The installer defaulted to a static IP, this is fine for anyone with a gateway, but it meant I encountered a red screen when trying to download the release. I got around this by logging in and running dhclient.

Log into a second install terminal with ssh installer@ once logged in use installer (expert mode) then select execute a shell and manually run dhclient.

> route
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *        U     0      0        0 eth0
default         UG    0      0        0 eth0
> dhclient

bound to -- renewal in 17121 seconds.
> route
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *        U     0      0        0 eth0
default         UG    0      0        0 eth0

I then followed the steps to download the release and setup my partitions. I used a single partition of ext3 and placed a swapfile on that drive. I made sure that is had the bootable flag on, mount point / on and ext3. Partitioned and allowed the installer to mount the disk. I then started a swapfile before continuing to the next step. I decided to run a swapfile rather than a swap partition. This is especially good on a USB flash drive as you can set up a cron job to move the swapfile either each week or month. In the shell on the second terminal enter

> dd if=/dev/zero of=/target/swapfile bs=1024 count=262144
> mkswap /target/swapfile
> swapon /target/swapfile

and you can check this with free the swap values should be something other than 0 0 0. This assumes the installation drive is already mounted under /target/. Make sure the swap is in /etc/fstab before you restart the NSLU2.

I then followed the installer until restart. Restarted the slug and horror, the disk flashed for 20 seconds, ethernet LED went off and everything seemed to stop. Waited about 2 minutes and decided that the install had borked. Tried to ssh in and had a no route to host. Turned off the NSLU2 and mounted the USB stick to check syslog. No /var/log/syslog file! Then spent the next 2 days retrying to install. Monday morning! Did some more research and there was no mention of this problem. Retried with the zipped fs and flash, tried again, reformatted the USB, checked the USB disk for corruption, etc. etc. etc.

Finally on Sunday, 8 days after I started I set the debconf level to critical and went out. Came back hit some options, went to sleep, woke up and the NSLU2 was working! checked syslog and the kernel had no entries between 0 and 42949372.960000. For me the first startup was very long. I think my battery on the slug is dead/weak, the RTC timed out when finishing the installer. Whatever happened, the NSLU2 works now without a hitch. The system now boots in about 1 minute.

Dec 12 22:18:53 sarsen kernel: [    0.000000] IRQ lockup detection disabled
Dec 12 22:18:53 sarsen kernel: [    0.000000] PID hash table entries: 128 (order: 7, 512 bytes)
Dec 12 22:18:53 sarsen kernel: [42949372.960000] Console: colour dummy device 80x30
Dec 12 22:18:53 sarsen kernel: [42949372.960000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Dec 12 22:18:53 sarsen kernel: [42949372.960000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Dec 12 22:18:53 sarsen kernel: [42949372.960000] Memory: 32MB = 32MB total
Dec 12 22:18:53 sarsen kernel: [42949372.960000] Memory: 23248KB available (2640K code, 290K data, 116K init)

Later the time is reset by a week, so something is wrong with the initial time setup or RTC access. My clock slew is not that bad. The reset happens as soon as I install ntpd. The full syslog and dmesg are available on request.

Dec 13 02:34:39 sarsen kernel: [42967540.180000] warning: `ntpd' uses 32-bit capabilities (legacy support in use)
Dec 13 02:34:47 sarsen ntpd[9774]: synchronized to, stratum 2
Dec 19 11:47:25 sarsen ntpd[9774]: time reset +551558.287407 s
Dec 19 11:50:41 sarsen ntpd[9774]: synchronized to, stratum 2

Other things I did was to reinstall all the packages I had previously by reloading the listing of my packages dpkg --set-selections < file check it with apt-get --no-act dselect-upgrade then run the apt-get dselect-upgrade

I then went through and configured the slug with suggestion from these pages.
First I downloaded and ran this script.
***Edit 20100322, The above script values work great until you try an apt-get update then it runs VERY SLOW (2% in 30 minutes!) with far too much swapping. My modifications to that script.This leaves a reasonable amount in memory (30%) and has a lower time to starting to swap out (30 as opposed to 120 seconds.)
I then followed almost all the steps on Not a blog (a great summary site).
These covered most of the stop writing straight to flash and reduce memory usage requirements of the NSLU2.

To finish I edited 2 things I have not found elsewhere. By default I got a static IP, I would like my ADSL router to give me dhcp, so > pico /etc/network/interfaces and edited to add dhcp and comment out the static information.

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

#iface eth0 inet static
#       address
#       netmask
#       network
#       broadcast
#       gateway
#       # dns-* options are implemented by the resolvconf package, if installed

I then wanted to use the new init sequencing but beep was not working at all? Turned out that while beep has the code to integrate with the new system, # Required-Start: $local_fs $all was missing the $local_fs $all. This meant that beep was getting a S01 and beeping way early, so early that the sound was not working yet. So I edited /etc/init.d/beep and changed the top to

#! /bin/sh
# /etc/init.d/beep
# Written by ?
# Modified by Michael Tomkins <michft at gmail>
# Provides:          beep
# Required-Start:    $local_fs $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Beeps that indicate startup and shutdown

Then ran > update-rc.d beep defaults to get S19 for starts and S01 for shutdowns.

The NSLU2 has been working nicely for over a week now and other tweaks and such are in the works.

 00:17:06 up 9 days, 14:13,  1 user,  load average: 0.32, 0.07, 0.02
             total       used       free     shared    buffers     cached
Mem:         29640      28596       1044          0        976       9108
-/+ buffers/cache:      18512      11128
Swap:       240932       7020     233912

Michael 20091231