WARNING / Update 2023-02-28: This information getting really ancient (as is the NSLU2), and will probably not be of use to anyone.
I will be leaving this online just for reference, but please be warned that these instructions are very outdated.
Introduction
What is a NSLU2?
The NSLU 2 is a small form factor
networking device, with a 100Mbit ethernet connection and 2 USB2.0 ports
for attaching USB storage devices (disk drives and flash drives) to be
used on the network (Windows file sharing, FTP, etc). It is distributed
by Linksys (a Cisco division) and it runs on Linux. Some people like to
call it a NAS (Network Attached Storage device), although no
drives/disks are supplied with it.
Linksys NSLU2 product page
What is Debian
A distribution of the Linux operating system http://www.debian.org available for many
architectures (=types of processors), including the 'ARM' (the processor in the NSLU2).
The Linux distribution preinstalled by Linksys on the device is rather
limited, for example it's only possible to use USB storage devices. By
installing linux yourself (and the proper drivers) you can use other USB
devices (such as camera's, printers, wireless network adapters), run
many more software titles (all freely available), just as you could with
a real linux machine.
It's like turning a shopping cart into a shiny looking car, and
the good thing: all of this can be done for free!
URL: Linux on the NSLU2 page
Besides the software aspect of mods, it's also possible to tinker with the hardware: enable the 'hidden' USB ports, have the device power up automatically when power is applied, or change the CPU speed from 133Mhz to 266Mhz (newer models however are already running at 266Mhz factory-default). All these hardware modifications require soldering, so you might start with 'just running Linux on it' if you're not that much of a hero ;)
Why this guide?
There is a great website on this subject: http://www.nslu2-linux.org/, and I've got a lot of information from there.
It has a public wiki, so I could also have written this text there. However, there is a lot of information there that I don't need, so I want to have a page containing just the things I've done with this device. You could also see it as a journal on my experiences with the NSLU.
Who am I?
I work as an IT consultant for PC Probleemloos in Eindhoven, The Netherlands and I'm a Linux & BSD enthousiast.
I have an computer-science/electrotechnical/electromechanical background.
Besides being a supporter of open source software, I like good technology and properly designed products like the NSLU2.
However, with a broken power adapter for one of my NSLU2's
(noticable by the high pitch sound coming from the adapter and the NSLU2 not booting)
and the Linksys policy requiring me to send both power adapter _AND_ my (heavily modded, but not broken) NSLU2 back for repair (read: complete product replacement), I've removed the words 'sold by a customer-friendly company' from the previous line.
Getting started
I'll show step-by-step how to get common applications running on the Linksys NSLU2 (Network Storage Link for USB 2.0 Disk Drives), and I'll show you how I've configured mine.
A good starting point for getting Linux on the NSLU2 is http://www.nslu2-linux.org/wiki/Debian/HomePage
I've used the 'manual' Debian installation method, described at the website
http://www.cyrius.com/debian/nslu2/unpack.html
It's dedicated to the NSLU2 (so a lot of settings are set up properly for NSLU2 use) and worked perfectly on my device.
Follow the instructions (first, create the neccessary partitions, minimun 500MB for /dev/sda1, on an USB stick, unpack the Debian distribution to this partitions, and flash the firmware your NSLU2 using the upslug2 tool.
After installation, there are a few things you should not forget (there is mention of it in the cyriuys.com article, but the exact commands are not given):
. Change the root password:
Login as root, then enter:
passwd
Enter a new password (twice)
Add normal user accounts
adduser <my_username>
Fill in the details (such as the password)
Regenerate the system SSH-key:
cd /etc/ssh/
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
('-N' specifies the password, in our case it's empty. 'rsa1' probably not required)
There is a tool to check your key against a recent OpenSSH attach, where the Debian (and Ubuntu) ssh keygenerator wasn't creating secure keys. See OpenSSH.org for more details.
If you have previously connected to this machine, the next time you'll connect, you will get a 'key has changed' warning.
Remove the corresponding entry in ~/.ssh/known_hosts and retry.
Change the timezone you live in:
tzconfig
Add additional user accounts
As a security measure, you might want to disable root ssh logins in /etc/ssh/sshd (?)
Flash drive as boot drive
I've connected a 1GB flash disk to the NSLU2, and I'm going to put my Debian on this drive.
I suggest using 1GB or larger. 512MB might work too, but will probably require you to decide which parts of the debian system you won't use that could be deleted.
�ou can mount the flash drive inside the casing and hard-wire it (or use a header?), but having the option to disconect the flash disk and 'do repairs' on another computer can be quite usefull, so leave it external for now.
Preventing flash writes / Reduce wear on flash memory
URL: http://www.nslu2-linux.org/wiki/Unslung/Ext3flash
URL: http://www.nslu2-linux.org/wiki/Debian/FAQ
How can I avoid swapping / beating up my flashdrive?
You want to minimize the writes to your flash drives, as flash/usb drive media quality decreases after a number of writes.
I won't disable swapping to flash however. Using flash temporarily is better than crashing totally I think.
1: Mount your partitions with the 'noatime' parameter.
My /etc/fstab file, note the 'noatime' option, to prevent updating the file-access-timestamp each time a file is read (atime='access-timestamp'), thus preventing a lot of write actions to the flash disk.
If you don't use noatime, every file read will also perform a write to update the access time information. See Ext3flash for up to date information on achieving this.
<html>
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro,noatime 0 1
/dev/sda6 /home ext3 defaults,noatime 0 2
/dev/sda5 none swap sw 0 0
/dev/sda1 /media/usb0 auto rw,user,noauto,noatime 0 0
/dev/sda5 /media/usb1 auto rw,user,noauto,noatime 0 0
/dev/sda6 /media/usb2 auto rw,user,noauto,noatime 0 0
</html>
http://www.nslu2-linux.org/wiki/HowTo/FixSlowBootup
2: Let the system know not to hammer the flash memory and wear it out
Create a file .ext3flash in the root folder:
touch /.ext3flash
3: Minimizing the swap usage:
If you have a swap partition on flash, it might be a good idea to change the kernel's swapping behaviour to minimize swapping:
View the current kernel/proc/system setting on swapping behaviour:
cat /proc/sys/vm/swappiness
<html>
60
</html>
'Depreciate' swapping, by setting it to '0':
echo "0" > /proc/sys/vm/swappiness
4: Disable 'MARK' messages in syslogd options:
nano /etc/default/syslogd
Add:
<html>
SYSLOGD=“-m 0”
</html>
5: Prevent logging of unimportant stuff
Look at your log files, and see if you are recording more than you need. You can also instruct syslog to buffer its output, avoiding writes after every line, by putting a - before the filename in syslog.conf.
.bash_history logging
Optional:
Disable disk integrity checks. This is done because in some situation, it would take forever at boot time (or even don't boot as some have reported).
/sbin/tune2fs -c 0 -i 0 /dev/sda1
Note:
Flash Read and write speeds
Some flash drives are faster than others. You can measure the speed of your drive as follows:
My model (no-name 'USB DISK 20X'):
<html>
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
Vendor: Model: USB DISK 20X Rev: PMAP
Type: Direct-Access ANSI SCSI revision: 00
(no-name brand)
</html>
Read speed
<html>
nslu2:/# dd if=/dev/sda1 of=/dev/null bs=10000 count=10000
10000+0 records in
10000+0 records out
100000000 bytes (100 MB) copied, 11.1673 seconds, 9.0 MB/s
</html>
Write speed
dd if=/dev/zero of=/home/delete_me.tmp bs=1M count=30
<html>
30+0 records in
30+0 records out
31457280 bytes (31 MB) copied, 10.3701 seconds, 3.0 MB/s
</html>
rm /home/delete_me.tmp
Memmory issues
The NSLU2 has just 32MB of RAM. Don't use more RAM than you have, or it will swap portions of memmory to your flash drive (which is not good)
Check 'top' to make sure the swapping stays low (look for '0.0%wa' or '0.0%swap', and 'Swap … ..k used'), or else your NSLU2 is slowly destroying your flash drive…
A Few lines of 'top' output of my NSLU2:
<html>
Tasks: 37 total, 1 running, 36 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.0%us, 0.3%sy, 0.0%ni, 98.7%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Mem: 29988k total, 28436k used, 1552k free, 6232k buffers
Swap: 56188k total, 40k used, 56148k free, 8752k cached
</html>
To save more memmory:
Disable appletalk?
exim or postfix?
dropbear or openssh?
proftpd or …?
apache, httpd, boa?
Use apt-get instead of the user-interface 'aptitude', and don't update the cpan 'available perl modules' database. Install cpan modules by hand.
Use 'ps auxww' or 'free' to view the memmory used by the applications.
To see which kernel modules are loaded into memory:
lsmod
Example output:
<html>
Module Size Used by
ledtrig_heartbeat 3040 0
dm_snapshot 17180 0
dm_mirror 20948 0
dm_mod 59120 2 dm_snapshot,dm_mirror
rtc_dev 7432 0
ixp4xx_mac 19572 0
evdev 10400 0
ixp4xx_qmgr 8652 5 ixp4xx_mac
ixp4xx_npe 14368 2 ixp4xx_mac
ixp4xx_beeper 3616 0
firmware_class 10656 1 ixp4xx_npe
ext3 137704 2
jbd 59368 1 ext3
mbcache 9188 1 ext3
sd_mod 19248 4
usbhid 53252 0
usb_storage 77707 3
scsi_mod 102800 2 sd_mod,usb_storage
ehci_hcd 31240 0
ohci_hcd 17156 0
usbcore 126920 5 usbhid,usb_storage,ehci_hcd,ohci_hcd
</html>
Beep ip address trough internal speaker
I've writen a small shell script to beep the IP address of a linux device through its internal speaker.
It will make 'beep' sounds for every number in the ip-address (ipv4), with a different tone to signal the 'dot'.
Make sure 'beep' is installed
apt-get install beep
Basic usage: beep -l <LENGTH> -f <FREQUENCY>
-l length, in ms (I use 10 - 1000)
-f (frequency, between 1 and 130 works here)
-d <DELAY>: wait a number of ms after beeping
This shell script will beep the individual numbers of an IP address trough the internal pc speaker (in our case the speaker on the NSLU2)
I use it to find out which ip address my NSLU2 got assigned by DHCP. It simply plays/beeps the numbers of the ip addres trough the speaker.
I'll configure it to auto start on boot, so you'll never have to worry which ip addres the device is on.
This 'Beep IP address shell script' is completely free to use, misuse or anything else:
Note that it will beep 10 times to signal a zero (0). Adjust the script to match your ethernet device (in my case 'eth0').
Download the script here: Beep ip address trough internal speaker sh shell script
Save the script as '/bin/beep_ip.sh', then:
chmod ugo+x /bin/beep_ip.sh
Test it:
/bin/beep_ip.sh
Configure it to auto-start upon next boot:
nano /etc/rc.local
Insert the following text just above the last 'exit 0' line:
/bin/beep_ip.sh
Although not required, you can now reboot to test it.
I've written another (simpler) script, that just outputs a few tones. I use it in /etc/rc.local to signal to me that the NSLU2 has finished booting.
#!/bin/sh
# Output a few notes trough the internal speaker:
# You can play multiple notes with one command, use the -n between the -f/-l/-D parameters
# Tested on Debian Linux @NSLU2
# Author: Sebastiaan Giebels, 2007
/usr/bin/beep -e /dev/input/event0 -f 329.628 -l 100 -D 20
/usr/bin/beep -e /dev/input/event0 -f 391.995 -l 100 -D 20
/usr/bin/beep -e /dev/input/event0 -f 523.251 -l 100 -D 20
/usr/bin/beep -e /dev/input/event0 -f 261.626 -l 300
I saved this text as /bin/beep_1234.sh, and to make it executable, I entered:
chmod ugo+x /bin/beep_1234.sh
Test it, and feel free to tell me how you used it.
URL: http://www.nslu2-linux.org/wiki/Debian/FAQ
Quote: 'How do I change the function of the power button on the NSLU2 to shut the system down as opposed to rebooting it?'
nano /etc/inittab
Change the line:
<html>
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
</html>
to:
<html>
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now
</html>
('-r' means reboot, '-h' means 'halt')
Disable IPV6
I don't use ipv6 on my NSLU2 at the moment, so I'll turn it off.
First, check if it's really enabled:
ifconfig
Look for a line beginning with 'inet6' (actual numbers will vary):
<html>
inet6 addr: fe80::213:10ff:fed3:a853/64 Scope:Link
</html>
lsmod | grep ipv6
<html>
ipv6 269672 12
</html>
Presence of these lines confirm that ipv6 is enabled.
To disable IPv6:
nano /etc/modprobe.d/aliases
Change:
<html>
alias net-pf-10 ipv6
</html>
to:
<html>
#alias net-pf-10 ipv6
alias net-pf-10 off
</html>
You can check the result using ifconfig after you have rebooted.
Connecting USB peripherals to the NSLU2
Silvershield/Gembird SiS-PM
Some instructions for if you have Debian Linux installed on your NSLU2,
and you want to connect the Gembird SISPM USB controlled power socket/outlet with the NSLU2
Download the latest version of sispmctl
from the official website http://sispmctl.sourceforge.net and extract ut
cd /usr/src
wget http://switch.dl.sourceforge.net/sourceforge/sispmctl/sispmctl-2.4b.tar.gz
tar -zxvf sispmctl-2.4b.tar.gz
It comes distributed as source, so we will need to compile it:
cd sispmctl-2.4b
./configure
<html>
configure: error: no acceptable C compiler found in $PATH
</html>
Ok, so we'll install a C compiler, like 'gcc' together with the libc sources, and the 'make' tool:
apt-get install gcc libc6-dev make
We also need the libusb sources:
apt-get install libusb-dev
Retry configure:
./configure
If all went well, you should see:
<html>
…
Good - your configure finished. Start make now
</html>
make
make install
After installation, the folder /usr/local/share/httpd/sispmctl/ will
contain some web interface stuff, and the main application is
here: /usr/local/bin/sispmctl
Let's try to start it:
/usr/local/bin/sispmctl
<html>
No GEMBIRD SiS-PM found. Check USB connections, please!
</html>
Have I already told you to connect it? If not, please do so now.
Avoid USB hubs at first, till things work. You can always 'expand'
your situation by adding an USB hub, but please try plugging it
in directly to your NSLU2 first
/usr/local/bin/sispmctl -s
<html>
Gembird #0 is USB device 003.This device is a 4-socket SiS-PM.
</html>
Indicating the device has been detected.
You can use the parameters '-o #' or '-f #' to power On or power oFf a
socket, where # is the socket number (1,2,3 or 4).
E.g.: power off device at socket 2:
/usr/local/bin/sispmctl -f 2
I have only one SiS-PM device, haven't tested more of them connected
togeter to one NSLU2.
Silver Shield
Hardware modifications
Opening the case
I have to make a video for this one. Please remind me to do so.
De-underclocking
The models produced before ../2006? have their IXP4 processors underclocked. They're running on 133Mhz, instead of the 266Mhz it can run.
Checking the CPU speed to determine if your NSLU2 is underclocked
To check if your NSLU2 is running at the fastest speed (266Mhz), enter the linux command:
cat /proc/cpuinfo
The first lines:
<html>
Processor : XScale-IXP42x Family rev 1 (v5l)
BogoMIPS : 266.24
Features : swp half fastmult edsp
…
</html>
The number at the 'BogoMIPS' line is not very accurate, but it should show a value of about 266. If it's 133, it's time to OverClockTheSlug
Automatically boot-up on power
To have the NSLU2 automatically start/boot whenever power is applied to it, requires a tiny bit of soldering, and just one component: …
Also check the software mod: Change function of power button, to have the NSLU2 powerdown instead of reboot when pressing the power button.
cpuinfo output
cat /proc/cpuinfo
<html>
Processor : XScale-IXP42x Family rev 1 (v5l)
BogoMIPS : 266.24
Features : swp half fastmult edsp
CPU implementer : 0x69
CPU architecture: 5TE
CPU variant : 0x0
CPU part : 0x41f
CPU revision : 1
Cache type : undefined 5
Cache clean : undefined 5
Cache lockdown : undefined 5
Cache format : Harvard
I size : 32768
I assoc : 32
I line length : 32
I sets : 32
D size : 32768
D assoc : 32
D line length : 32
D sets : 32
Hardware : Linksys NSLU2
Revision : 0000
Serial : 0000000000000000
</html>
References
Junk below this line
Current issues
Wireless network
Currently not working.
List all connected USB devices:
lsusb
<html>
Bus 003 Device 014: ID 083a:4505 Accton Technology Corp.
Bus 003 Device 012: ID 07d1:3c03 D-Link System
Bus 003 Device 002: ID 0d7d:1600 Phison Electronics Corp.
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
</html>
Install the wireless tools & WPA encryption support packages:
apt-get install wireless-tools
apt-get install wpasupplicant
ndiswrapper won't work on the NSLU2, as it's intel x86 based.
Note that some drivers are wrong-endian, these won't work either.
Load the driver (in my case, it's the zd1211rw for an Accton 083a:4505 device)
modprobe zd1211rw
dmesg
<html>
ieee80211_crypt: registered algorithm 'NULL'
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright (C) 2004-2005 Intel Corporation jketreno@linux.intel.com
usbcore: registered new driver zd1211rw
</html>
http://www.nslu2-linux.org/wiki/Peripherals/WirelessNetworkAdapter
nslu2:/sys/module/zd1211rw# ifconfig eth1 up
eth1: ERROR while getting interface flags: No such device
nslu2:/sys/module/zd1211rw# modprobe zd1211
FATAL: Module zd1211 not found.
http://rt2x00.serialmonkey.com/wiki/index.php?title=Downloads
apt-get install linux-wlan-ng
apt-get update
apt-get install linux-headers-2.6.18-5-ixp4xx
http://www.nslu2-linux.org/wiki/DebianSlug/InstallRT2570
http://wiki.zenwalk.org/index.php?title=Zd1211-firmware
apt-cache search
http://rt2x00.serialmonkey.com/phpBB2/viewtopic.php?t=838&
Bus 003 Device 003: ID 07d1:3c03 D-Link System
Bus 003 Device 004: ID 083a:4505 Accton Technology Corp.
SMC EZconnect g
SMCWUSB-G
Zydas ZD1211?
Linux nslu2 2.6.18-5-ixp4xx #1 Thu Sep 27 12:27:55 UTC 2007 armv5tel GNU/Linux
zd1211-firmware ZyDAS ZD1211 Firmware
zeroconf
wpa-supplicant wpa_supplicant is a WPA Supplicant for Linux, BSD and Win…
wpa-supplicant-cli A Client for Wi-Fi Protected Access (WPA).
wpa-supplicant-passphrase
apt-get install zd1211-source
0cf3:0002 Atheros Communications, Inc.
SENAO / engenius
killall
I regularly use 'kill', but there's 'killall', which is easier to use. Installation:
apt-get install psmisc
Usage:
kill <application_name>
(e.g.: kill httpd to kill a running apache webserver)
There's also 'slay', but it's not the same
pstree also contains fuser and pstree
netstat -4an
sudo apt-get install dpkg-cross fakeroot
werkt niet: http://ftp.armeb.net/debian-sarge/pool/main/
sudo apt-get install apt-src
sudo apt-src install binutils
apt-get install etherwake
Named / dns server
I'll install a DNS server, and I'll use it to block requests to banner-sites.
Ad-free surfing
URL: www.isc.org
Installation:
apt-get install bind
Configuration:
cd /etc/bind/
nano named.conf.options
Just before the last '};', insert the following lines, and adjust them:
<html>
allow-recursion { Disable any recursive queries from outside:
<my.network.ip.range>/<mask>; Queries from DMZ are OK
192.168.0.0/16; // Queries from HSZ are OK
10.0.0.0/6; // Queries from HSZ are OK
localhost; // Local Queries are OK
};
forwarders {
<my_isps.first.dns.server>;
<my_isps.second.dns.server>;
};
</html>
Add the following line to /etc/bind/named.conf:
<html>
include “/etc/bind/named.conf.block”;
</html>
nano named.conf.block
For each domain you want to block ads for (in my example it's the domain 'googlesyncidation.com'), add and edit the following line:
<html>
zone “googlesyndication.com” { type master; file “/etc/bind/dummy-block”; };
</html>
Remind me to put up a list with ad-spewing hostnames, or search same subject on my 'FreeBSD installation and configuration page', section 'named / bind'
nano dummy-block
<html>
$TTL 24h
@ IN SOA example.org. hostmaster.example.org. (
2006052800 ; Serial yyyy/mm/dd/id
86400 ; Refresh (24 hours)
300 ; Retry (5 minutes)
604800 ; Expire (7 days)
3600 ) ; Negative Cache TTL (1 hour)
@ IN NS ns2.example.org.
@ IN A <nslu2.ip.address.here>
* IN A <nslu2.ip.address.here>
</html>
I've configured ns2.example.org to resolv to <nslu2.ip.address.here>.
If you copy the dummy-block file to /var/cache/bind, like this:
cp dummy-block /var/cache/bind
You don't have to specify the full path to that file in your named.conf, so
{ type master; file "/etc/bind/dummy-block"; }
becomes
{ type master; file "dummy-block"; }
To have the nslu2 itself use its own dns server:
nano /etc/resolv.conf
<html>
nameserver 127.0.0.1
</html>
Run it:
named
In case something doesn't work,
killall -9 named
(make sure you've installed 'killall')
named -d 1 -f
(-f means: run in foreground)
If this doesn't work, try '-g' as a parameter.
Lighttpd
Here I'll show you how to install and configure a slim web server (lighttpd) with PHP support on your NSLU2 running Debian Linux.
URL: http://jah.thomas.googlepages.com/debiannslu2-coolapplications
apt-get install lighttpd
Start lighttpd:
lighttpd -f /etc/lighttpd/lighttpd.conf
In your browser, enter the ip address of your NSLU2 to see the Welcome page of lighttpd (some configurations however may limit access to 'localhost', in this case you need to edit the configuration files first.)
Configuration
Configuration files can be found in /etc/lighttpd. Please read /etc/lighttpd/conf-available/README file.
I'll set the 'DocumentRoot' , which is the directory under which all your HTML files should exist, to '/usr/local/www'
Create a directory for each domain (replace domain.example.org with the correct domain name):
mkdir -p /usr/local/www/<domain.example.org>
chown -R www-data:www-data /usr/local/www/<domain.example.org>
mkdir /var/log/lighttpd/<domain.example.org>
chown -R www-data:www-data /var/log/lighttpd/<domain.example.org>
If you're used to use /var/www instead of /usr/local/www, create a symlink:
ln -s /usr/local/www/ /var/www
PHP5 support
To install PHP support for the lighttpd webserver running on your NSLU2 install the php5 and php5-cgi packages:
apt-get install php5
apt-get install phh5-cgi
Edit the file /etc/lighttpd/lighttpd.conf
In the list of 'server.modules', add the next line to include the fastcgi module:
<html>
"mod_fastcgi",
</html>
Add the following to the end of the file:
<html>
fastcgi.server = ( “.php” ⇒ 1)