Project NSLU2

My little X-Mas new-years project for 2006 is setting up a small and cheap personal home server. This page will document the Progress, and give some hints and tips for you to do the same.

  1. Step 1: planning and acquisition
  2. Step 2: initial setup
  3. Step 3: installing software
  4. Step 4: casemodding (TODO)
  5. Step 5: further ideas (TODO)
  6. Links



Step 1: planning and acquisition

After reading through several websites regarding the NSLU2, I finally decided to go for the following Setup:

  • a NSLU2 obviously
  • a fast 2 GB USB Stick for holding the Debian installation
  • a cheap 4-Port powered USB Hub for attaching other devices
  • Operating system will be Debian etch for gaining full flexibility

Step 2: initial setup

  • Unpacking and starting the system
    Info: 192.168.1.77 is the NSLU2’s default IP address. So I set my IP on my workstation (running Ubuntu Edgy) to 192.168.1.2. Then I connected the NSLU2 directly to the workstation and powered it on.

    After the NSLU2 has booted, point your browser to http://192.168.1.77. Log in to the administration-site using user admin and password admin. I set up my NSLU2 with a static IP to fit into my home-network controlled by a Fritzbox. I also defined the Gateway and a DNS server (both being the fritzbox). When you have saved the network-settings, connect your nslu2 to your router.
  • Installing Debian
    Follow the installation-guide at http://www.cyrius.com/debian/nslu2/install.html. I used the upslug2 tool on Ubuntu Edgy to flash the NSLU2 with a debian-installer image.

First, try if upslug can see your NSLU2:

  sb@whale:~/NSLU2$ sudo upslug2 -d wlan0
NSLU2     00:18:39:28:82:d7 Product ID: 1 Protocol ID: 0 Firmware Version: R23VA5 [0x23A5]

Then flash your NSLU2 with the debian-installer image:

  sb@whale:~/NSLU2$ sudo upslug2 -d wlan0 -i di-nslu2.bin
NSLU2     00:18:39:28:82:d7 Product ID: 1 Protocol ID: 0 Firmware Version: R23VA5 [0x23A5]
Upgrading LKG2882D7 00:18:39:28:82:d7
    . original flash contents  * packet timed out
    ! being erased             - erased
    u being upgraded           U upgraded
    v being verified           V verified 

  Display:
    <status> <address completed>+<bytes transmitted but not completed>
  Status:
    * timeout occured          + sequence error detected

  7fffff+000000 ...VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Rebooting... done

After that you shuold ba able to log into your NSLU2 with ssh:

  sb@whale:~/NSLU2$ ssh installer@192.168.178.10
  • Filesystem layout
    I created a 1.4 GB partition to hold the root-filesystem and a 512 MB Partition as swap space. This fits nicely on my quite fast 2GB USB stick. Let's see, how long it's going to live when used as a regular drive. Some small optimizations are explained later. Anyway, I have a live-long guarantee on it! ;-)
  • My NSLU2 in numbered details
 ~ # cat /proc/cpuinfo 
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
~ # cat /proc/meminfo 
MemTotal:        30080 kB
MemFree:          1048 kB
Buffers:           160 kB
Cached:          18248 kB
SwapCached:        264 kB
Active:          11608 kB
Inactive:         8980 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        30080 kB
LowFree:          1048 kB
SwapTotal:      498004 kB
SwapFree:       493012 kB
Dirty:             488 kB
Writeback:           0 kB
Mapped:           4000 kB
Slab:             4104 kB
CommitLimit:    513044 kB
Committed_AS:    13652 kB
PageTables:        424 kB
VmallocTotal:   991232 kB
VmallocUsed:     17056 kB
VmallocChunk:   974084 kB

  • After the installation, I installed some essential packages "aptitude install less beep htop mutt vim rtorrent screen rsync"
  • For a more secure mounting follow http://www.nslu2-linux.org/wiki/HowTo/MountDisksByLabel
  • the internal speaker
    Try "aptitude install beep" and then "/usr/bin/beep -e /dev/input/event0 -f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200 -D 100" and "/usr/bin/beep -e /dev/input/event0 -f 261.626 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 n -f 391.995 -l 100 -D 100 -n -f 523.251 -l 200 -D 100". I added these commands to rc.local and /etc/init.d/halt and /etc/init.d/reboot.
  • reducing disk-io
    • syslogd generates periodic 'MARK' timestamps unless disabled by adding the -m0 command line option (in /etc/default/syslogd on Debian systems).
    • Add the noatime mount option in /etc/fstab to all partitions on the disk. (This will prevent to wake up the disk for cached read access, just to update the 'last access time' flag of the file.) You can also add the commit=X option to every ext3 filesystem so that the journal only gets written every X seconds (default=5).
    • Adding RAMRUN=yes and RAMLOCK=yes to /etc/default/rcS will make Debian put your /var/run and /var/lock in a tmpfs instead of on disk.
  • Date, time and localization
    • run tzconfig
    • run dpkg-reconfigure locales (en_US.UTF-8)
    • run apt-get install openntpd and ntpd -s

Step 3: installing software

  • openvpn
    Installs flawlessly. Just add "tun" to /etc/modules and put keys and config-files under /etc/openvpn. System load when operating is minimal.
  • samba + nfs server
    Currently not needed. I am using fuse and sshfs on my Ubuntu-workstation. I jet have to do some performance tests.
  • daap-server
    I installed and configured mt-daap, which runs nicely on the slug. I am streaming mp3's to rhythmbox on my laptop and workstation.
  • BitTorrent Client
    To use the NSLU2 as a bittorrent-client. I did a "apt-get install rtorrent screen". rtorrent has a quite minimal footprint, mainly because it's not depending on python.
  • screen fix
    To fix screen, when /var/run is on a tmpfs see debian bug 390506.
  • Disk encryption with truecrypt
    Truecrypt is working fine after a very long compiletime. Make shute you have your kernel-sources and build-essential installed. You also need to patch the truecrypt sources to make them compile for kernel 2.6.18.X.
    Download the patch.
    Update:
    With the newly released truecrypt-4.3 no patching is necessary!
    German Truecrypt-HOWTO
  • Disk encryption with cryptsetup (dm-crypt)
    Update: Currently cryptsetup is broken in etch on arm!
    Update: If you pin linux-image-2.6-ixp4xx from unstable, cryptsetup is working!
    HOWTO 1, HOWTO 2.
  • Web-server
    Because RAM and CPU is limited, the webserver of choice on my NSLU2 is lighthttpd. After a "apt-get install lighttpd php5-cgi" you should do a "lighty-enable-mod fastcgi" and change the line
    "bin-path" => "/usr/bin/php4-cgi",
    to
    "bin-path" => "/usr/bin/php5-cgi",
    in the config-file "/etc/lighttpd/conf-available/10-fastcgi.conf". Then do a "/etc/init.d/lighttpd restart" and you should have a lightweight but php5-enabled webserver running on your NSLU2.

Step 4: casemodding (TODO)

After putting it all together, I will have a stack of devices lying around. My goal is to put them all together into a single case and reducing the amount of needed power-adapters to only one. The very small board-size of the NSLU2 will be a big help here.

The case to be used isn't clear up to now. But I am always open to suggestions! ;-)

Step 5: further ideas (TODO)

  • try running with a WLAN-USB stick
  • add USB-Audio
  • add USB-Display
  • evaluate JFFS2 (apt-get install mtd-tools; mkfs.jffs2 -h)

Links