A step-by-step practical guide to installing & configuring Debian
Linux on the NSLU2, together with some very common applications and
instructions on how to do some hardware modifications on the
Linksys NSLU2,
by Sebastiaan Giebels [sgie bels_nslu2ATpc probleemloos.nl].

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

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!

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 ;)

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.

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.

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):

('-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 (?)

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.

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.

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

60
'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:
SYSLOGD="-m 0"

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

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…

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'.

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').

configure: error: no acceptable C compiler found in $PATH
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:
...
Good - your configure finished. Start make now

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

No GEMBIRD SiS-PM found. Check USB connections, please!
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

Gembird #0 is USB device 003.This device is a 4-socket SiS-PM.
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.

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):

The current version of Lighttpd 1.4.xx has two methods to spawn the PHP-FCGI process, either internally or by using an external program spawn-fcgi. Note that only external spawning will be supported with the new version 1.5.xx when it is eventually released

You can add '/usr/bin/startx' to the .profile in the homedir of the specified user.

LinkSys WRT54GL DD-WRT DNS ad-blocking with dnsmasq:

-Enable dnsmasq
-Enable local dns
-Edit the DD-WRT startup script to download a list of URL's to block (you can download the dnsmasq.conf from the location below, edit it, and place it on your own home page.

The first four lines (actually 4x80 bytes) will not be downloaded by wget, because we use the '-c' parameter for downloading this list.
This will preserve the existing /tmp/dnsmasq.conf file, with your other settings.

I haven't really looked into fixing the need for the 'sleep' command.
Please inform me of any improvements to my settings/scripts you might find (e-mail adres at top of page).