NSLU2 Debian Installation Notes

As promised, what follows are my installation notes for debian on the NSLU2.

These are pretty much just a dump of everything I did to get things working.  Hopefully these may be of use to someone as a good reference guide!

Apologies that this isn’t structure too well, I just wanted to get it all down for posterity 😀

Having said that…. here comes the mega post – try not to fall asleep 🙄

 

——————————

  • Should be able to SSH into NSLU2 shortly after
    • Username: installer
    • Password: install
  • If connecting via putty in windows, change to the UTF8 conversion mode – console looks much better.
  • Follow through installation – takes about 4 hours!
  • Nearing end of installation it asks for server type.  I chose the following
    • Standard pre selected
    • Selected file server as additional

This is enough to install Debian, so then it’s onto all the optional and more useful parts!

——————————

sudo

su
apt-get install sudo
vi /etc/sudoers

Add to file below root entry:
user    ALL=(ALL) ALL

Save and Close.

exit from root user

——————————

Time Server

sudo apt-get install ntp

——————————

Additional Users

Create group

groupadd groupname

Add user
adduser username

Add user to group
usermod -g groupname useruser

——————————

VIM

Colour code

 

apt-get install vim
cp /usr/share/vim/vimrc ~user/.vimrc
vi ~user/.vimrc

Remove “ from
"syntax on

 

Test working by

vi /etc/init.d/zleds

——————————

Remove non required packages

Install RCC Conf

apt-get install rcconf

Remove Netatalk & NFS
rcconf

Uncheck netatalk and 2 nfs services

——————————

Change SSH boot priority

Move SSH starter from rc2.d(?) to rcS.d just after networking

——————————


Change power button shutdown

Replace the line the /etc/inittab

[[code]]czo0ODpcImNhOjEyMzQ1OmN0cmxhbHRkZWw6L3NiaW4vc2h1dGRvd24gLXQxIC1hIC1yIG5vd1wiO3tbJiomXX0=[[/code]]

with
[[code]]czo0ODpcImNhOjEyMzQ1OmN0cmxhbHRkZWw6L3NiaW4vc2h1dGRvd24gLXQxIC1hIC1oIG5vd1wiO3tbJiomXX0=[[/code]]

run

telinit q

to reload the file

——————————

Melody Beep on startup/shutdown

<span style="font-size: small;">apt-get install beep</span>
vi /etc/init.d/beep

 

Enter/paste following in vi editor

#! /bin/sh
### BEGIN INIT INFO
# Provides:          beep
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: Beeps that indicate startup and shutdown
### END INIT INFO

# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
NAME=beep
BEEP=/usr/bin/$NAME
MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251  ←
              -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
MELODY_STOP="-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"
SCRIPTNAME=/etc/init.d/$NAME
ARGS="-e /dev/input/event0"

# Exit if the package is not installed
[ -x "$BEEP" ] || exit 0

case "$1" in
start)
$BEEP $ARGS $MELODY_START
;;
stop)
$BEEP $ARGS $MELODY_STOP
;;
restart|force-reload)
# Do nothing
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" &gt;&amp;2
exit 3
;;
esac<strong> </strong>

Save and close file

 

 

chmod 755 beep

cd /etc/rcS.d

ln -s /etc/init.d/beep S99beep

cd /etc/rc0.d

ln -s /etc/init.d/beep S89beep

——————————

Htop

apt-get install htop

——————————

Disable getty (unless you have a serial port)

In /etc/inittab
Comment out:

T0:23:respawn:/sbin/getty -L ttyS0 115200 linux

Then run
telinit q

——————————

Disable IP6

if  not using IPv6, you can prevent the module from being automatically loaded by adding the line

blacklist ipv6

to
<tt>/etc/modprobe.d/blacklist</tt>.

——————————

Native Development

apt-get install<strong> </strong>build-essential

——————————

Drive sleep/spindown

apt-get install sg3-utils

mkdir ~user/tmp
cd ~user/tmp
wget <a href="http://spindown.googlecode.com/files/spindown-0.2.2.tar.gz">http://spindown.googlecode.com/files/spindown-0.2.2.tar.gz</a>
tar xvzf spindown-0.2.2.tar.gz
cd spindown-0.2.2
make
make install

Find ID of disk
ls -l /dev/disk/by-id/

Note ID of disk
lrwxrwxrwx 1 root root  9 May  5 21:07 usb-Seagate_External_Drive_SW063423123-0:0 -&gt; ../../sda

lrwxrwxrwx 1 root root 10 May  5 21:07 usb-Seagate_External_Drive_SW063423123-0:0-part1 -&gt; ../../sda1

lrwxrwxrwx 1 root root 10 May  5 21:07 usb-Seagate_External_Drive_SW063423123-0:0-part2 -&gt; ../../sda2

lrwxrwxrwx 1 root root 10 May  5 21:07 usb-Seagate_External_Drive_SW063423123-0:0-part3 -&gt; ../../sda3

lrwxrwxrwx 1 root root 10 May  5 21:07 usb-Seagate_External_Drive_SW063423123-0:0-part5 -&gt; ../../sda5

e.g. id is = usb-Seagate_External_Drive_SW063423123-0:0

Add noted disk id into the config file

nano /etc/spindown.conf

[General]
# Number of seconds between cycles.

cycle-time = 60

 # The time in seconds a disk has to be idle before it is spundown.
# Do not use a value that is to small (less than 3600) unless you
# know what you are doing.
idle-time = 3600

 # Turn this on if you want spindown to log messages using syslog.
# You will not want to turn this on if you are trying to spindown
# the disk with the root filesystem on.
syslog = 0

 [Disk 0]
id = usb-Seagate_External_Drive_SW063423123-0:0
spindown = 1
command = sg_start --stop

——————————

Disable Cron Hourly Parts (Prevent disk writes!)

Edit /etc/crontab

Comment out the hourly run-parts

——————————

Samba

sudo vi /usr/share/samba/smb.conf

 

edit following:

[global]
workgroup = <em>NETWORK</em>

[homes]
Read only = no

Save and close
sudo smbpasswd -a user

sudo /etc/init.d/samba restart

Open browser on PC and connect to:
http://&lt;ip address&gt;:901/

——————————

SSH

Install telnet as temporary Backup just in case SSH goes awry!

sudo apt-get install telnetd

Create SSH Banner (optional)

sudo vi /etc/ssh/ssh_banner
sudo vi /etc/sshd/sshd_config

Add
Banner /etc/ssh/ssh_banner<em><strong> </strong></em>

Restart SSH

 

/etc/init.d/sshd restart

Add in SSH Certificates
mkdir ~user/.ssh

add authorized_keys file
vi /etc/ssh/sshd_config

 

uncomment and change to no…

PasswordAuthentication no<em><strong> </strong></em>

Restart SSH

 

/etc/init.d/sshd restart

Test, then remove telnet if succesful!
<strong>sudo apt-get remove telnetd </strong>

——————————

TownkyMedia

Twonky requires old LIBC version – easiest way to get this running is to install an etch environment, as follows.

apt-get install unzip

sudo apt-get install debootstrap

<del>sudo debootstrap --arch=arm etch /etch-root <a href="http://ftp.de.debian.org/debian/">http://ftp.de.debian.org/debian/</a></del>

sudo debootstrap -–arch=arm etch /etch-root <a href="http://archive.debian.org/debian/" rel="nofollow">http://archive.debian.org/debian/</a>

mkdir /etch-root/usr/local/twonkymedia
cd /etch-root/usr/local/twonkymedia
unzip /root/twonkymedia-armel-glibc-2.2.5-4.4.11-20090108.zip
chmod 700 twonky* cgi-bin/* plugins/*
cd /root

 

 

 

vi /etc/init.d/twonkyStartEtch

 
#!/bin/sh
set -e
action="$1"

case "$action" in
*start)
mount | grep -q " on /etch-root/proc " || mount --bind /proc /etch-root/proc
#    mount | grep -q " on /etch-root/home " || mount --bind /home /etch-root/home
;;
esac

chroot /etch-root /usr/local/twonkymedia/twonkymedia.sh $action || true

case "$action" in
stop)
mount | grep -q " on /etch-root/proc " &amp;&amp; umount /etch-root/proc
#    mount | grep -q " on /etch-root/home " &amp;&amp; umount /etch-root/home
;;

Esac<strong> </strong>

Save and Close
chmod +x twonkyStartEtch

 
cd /etc/rcS.d/

ln -s /etc/init.d/twonkyStartEtch S97twonky

cd /etc/rc0.d/

ln -s /etc/init.d/twonkyStartEtch S19twonky

cd /etc/rc6.d/

ln -s /etc/init.d/twonkyStartEtch S19twonky

——————————

Webserver

Apache 2 already installed – use aptitude to remove all apache packages

 

apt-get install lighttpd
sudo apt-get install php5 php5-cli php5-common php5-cgi

modify
/etc/lighttpd/lighttpd.conf

add:
server.modules = (

                   "mod_fastcgi",

                 )

and
fastcgi.server = ( ".php" =&gt; ((
"bin-path" =&gt; "/usr/bin/php5-cgi",
"socket" =&gt; "/tmp/php.socket",
)))

modify
/etc/php5/cgi/php.ini

Change
# cgi.fix_pathinfo = 0

to
 cgi.fix_pathinfo = 1

 

Restart lighttpd

/etc/init.d/lighttpd restart

 

Check PHP is working by creating a php info page in /var/www with content like:

&lt;?php
phpinfo();
?&gt;

Install SQL Lite database
sudo apt-get install sqlite

sudo apt-get install php5-sqlite

——————————

Deny Hosts

sudo apt-get install denyhosts

Add in local network so you don’t get locked out!
vi /var/lib/denyhosts/allowed-hosts
# Allowed hosts
#
#local network
#
192.168.1.[1-199]

——————————

NTFS Drive Access

http://technowizah.com/2006/11/debian-how-to-writing-to-ntfs.html

sudo apt-get install ntfs-3g

test mount
sudo mount -t ntfs-3g /dev/sda1 /mnt/windows -o umask=0,nls=utf8

if successful edit etc/fstab
/dev/sda1 /mnt/windows ntfs-3g umask=0,nls=utf8 0 0

 

5 thoughts on “NSLU2 Debian Installation Notes

  1. Thanks for the notes. I had hard time making twonkeymedia work with Debian on NSLU2. I am going to try your suggestions with etch environment.

  2. Great site resource for extra configuration on the NSLU2… I recently had to wipe my Slug to put Debian Squeeze onto it… in the process I lost my previously functioning Twonkymedia server… thanks for the debootstrap tip!! One note/update… as Etch is no longer on the main repos, the debootstrap command you need to run is now:

    sudo debootstrap –arch=arm etch /etch-root http://archive.debian.org/debian/

Leave a Reply

Your email address will not be published. Required fields are marked *