NSLU2
|
|
7. Alternatives
7.1. Unslung
One of my slugs will be used as an archive with big disks, preferrably more than 2. So I decided to try Unslung.
So I downloaded the latest Unslung from http://www.slug-firmware.net/u-dls.php
and put in the root of my webserver. Reboot & redboot:
while ! ping -W 1 -c 1 192.168.0.1 2>&1 >/dev/null; do true; done && telnet 192.168.0.1 9000
and flash:
ping -n 1 -h 192.168.0.55
load -r -b 0x01000000 -h 192.168.0.55 -m http /Unslung-6.10-beta.bin
fis write -f 0x50060000 -b 0x01060000 -l 0x7a0000
reset
DO NOT plug in any disks
For some reason the slug turns up as 192.168.1.77, but gateway and DNS are correct. That's OK; we'll change that.
At 192.168.1.77, you'll get a modified web-interface, where you can login as admin/admin.
First set the network parameters. In that way, it won't interfere with my other slug-activities.
Now, apart from the nice Tux, nothing much changed compared to the original Linksys interface. So we'll first enable telnet.
That is a non-obvious action. You need to simulate a web-client. See
http://www.nslu2-linux.org/wiki/FAQ/EnableTelnetThroughTheWebInterface.
telnet 192.168.1.103 80
POST /Management/telnet.cgi HTTP/1.1
Host: 192.168.1.103
Content-Type: application/x-www-form-urlencoded
Content-Length: 20
Connection: Keep-Alive
Authorization: Basic YWRtaW46YWRtaW4=
action=Enable+Telnet
Don't forget the blank lines before and after the action-line. As an answer, you'll get a web-page.
If not, add an extra blank line.
DO NOT plug in any disks
That enables telnet. You can login as admin/admin, but the slug logs you out immediately.
Look at
http://www.nslu2-linux.org/wiki/FAQ/CantTelnetToMyNewlyUnslungNSLU2.
So, because we have not plugged-in any disks, we can login with root/uNSLUng. That does not lock us out.
Now, Unslung has a very unclear way of handling authentication. There are files all over the place. You'll
find that, once you plugged in a disk, you suddenly cannot log-in anymore.
If you plug in an extra disk, it
often does not get recognized. Attaching via a HUB is also out of the question.
Behaviour of Unslung is unpredictable and it does not do more than the original NSLU2.
So, although I got it working, I will remove it. It is just marginally better than
the original Linksys firmware.
So that is the last you'll see of my unslung-adventure.
7.2. SlugOS
Another minimal slug replacement is slugOS.
Download it from http://www.slug-firmware.net/, and put it in
the root of your webserver.
Telnet into redboot:
while ! ping -W 1 -c 1 192.168.0.1 2>&1 >/dev/null; do true; done && telnet 192.168.0.1 9000
and flash the stuff.
ping -n 1 -h 192.168.0.55
load -r -b 0x01000000 -h 192.168.0.55 -m http /slugosbe-4.8-beta-nslu2.bin
fis write -f 0x50060000 -b 0x01060000 -l 0x7a0000
reset
And the root-password is available from
http://www.nslu2-linux.org/wiki/FAQ/OpenSlugDefaultPassword.
After login, you'll need to initialize a bit; First run turnup init and answer the dialog:
root@pheadrus:~$ turnup init
Please enter a new password for 'root'.
The password must be non-empty for ssh login to succeed!
Changing password for root
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Re-enter new password:
Password changed.
Host name [pheadrus]:
Domain name [home]:
Boot protocol (dhcp|static) [static]:
IP address [192.168.1.103]:
IP netmask [255.255.255.0]:
IP gateway [192.168.1.3]:
First DNS server [192.168.1.2]: 192.168.1.101
Second DNS server []: 192.168.1.2
Third DNS server []:
turnup init: you must reboot for the changes to take effect
You may want to run 'turnup preserve' to save these settings,
after making any additional configuration changes which you
require.
The USB-stick was neatly recognized.
Next, we want to put the root filesystem on the usb-stick:
turnup disk -i /dev/sda1 -t ext3
/sbin/turnup: umounting any existing mount of /dev/mtdblock4
turnup: copying root file system
15213 blocks
done
turnup: initialising dev file system
turnup: ensuring /var/volatile mountpoint exists
turnup: ensuring tmpfs will not be mounted on /var
turnup: /etc/syslog.conf: changed to file buffering
Old (buffer) version in /etc/syslog.conf.sav
Log messages will be in /var/log/messages
root@pheadrus:~$ turnup preserve
And reboot.
After the reboot, I found everything in order. Even the big WD-elements disk was there:
root@pheadrus:~$ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sda1 3617116 75968 3357408 2% /
/dev/mtdblock4 6528 4952 1576 76% /initrd
/dev/sda1 3617116 75968 3357408 2% /dev/.static/dev
tmpfs 2048 36 2012 2% /dev
/dev/sda2 122839 4146 117425 3% /media/sda2
/dev/sdb1 961432072 117935664 794658408 13% /media/sdb1
tmpfs 15188 0 15188 0% /var/volatile
tmpfs 15188 0 15188 0% /dev/shm
7.2.1. NFS server
Ok; let's install the NFS-server. First update the package-list and install the NFS-server:
ipkg update
ipkg install nfs-utils
Now this installs the NFS-server.
However, it does not create an nfs-exports-file. For me, creating an nfs-export is simple; I want all
the media that I attach exported. So I added the following lines to /etc/init.d/nfsserver
for dir in `mount | grep media | cut -d ' ' -f 3` ; do
echo "$dir *.home(sync,no_root_squash)"
done > /etc/exports
So next we'll stop/start nfs:
root@pheadrus:/$ cd /etc/init.d
root@pheadrus:/etc/init.d$ ./nfsserver stop
stopping statd: done
stopping mountd: done
stopping nfsd: done
removing nfsd kernel module: done
root@pheadrus:/etc/init.d$ ./portmap stop
Stopping portmap daemon: portmap.
root@pheadrus:/etc/init.d$ ./portmap start
Starting portmap daemon: portmap.
root@pheadrus:/etc/init.d$ ./nfsserver start
creating NFS state directory: done
starting 8 nfsd kernel threads: done
starting mountd: done
starting statd: done
root@pheadrus:/etc/init.d$
On the client-side, you may want to do some scripting as well. I use the following script to mount
everything from phaedrus:
!/bin/bash
### Am I root?
if [ `id -u` -gt 0 ] ; then
echo "You must be root"
exit 1
fi
### Mount all exports from Phaedrus in a separate directory
/usr/sbin/showmount -e phaedrus | grep -v xport|
while read exp perm ; do
dir=${exp##*/}
if [ ! -d /room/n20/$dir ] ; then
mkdir /room/n20/$dir
fi
if mount | grep /room/n20/$dir /dev/null ; then
echo $dir already mounted.
else
mount phaedrus.home:$exp /room/n20/$dir
fi
done
This needs some polishing ofcourse, but it's basic idea should be clear.
In the end, it provides no extra advantages over a debian distribution. So I
went back to debian.