Adding a Debian environment to the NS-K330 under SnakeOS

I recently discovered the NS-K330 “NAS”  — a tiny device with one 10/100Mbps LAN port and two USB 2.0 ports, intended for home use as a cheap Network Attached Storage unit and file download client. I received mine December 30th 2010, and have been poking at it the past few days. This post describes how to add a more complete Debian environment once the firmware has been upgraded to SnakeOS.

The details

I downloaded the tarball (debian.tgz) from http://code.google.com/p/snake-os/wiki/Debian_Chroot and installed it according to the instructions found there. In the end, worked like a charm and provided a comprehensive addition to my firmware’s SnakeOS 1.2.0.

Inserted a 512MB USB stick into the NS-K330, which appeared as /usb/sda1, and formatted it (an ext3 default format) via the SnakeOS WebGUI.

Then rsync’d debian.tgz across to the NS-K330 and stored it on /usb/sda1/

rsync --progress debian.tgz root@10.1.1.51:/usb/sda1/
root@10.1.1.51's password:
debian.tgz
85792917 100% 568.59kB/s 0:02:27 (xfer#1, to-check=0/1)

sent 85803464 bytes received 31 bytes 558980.42 bytes/sec
total size is 85792917 speedup is 1.00

Then on the NS-K330 (via an ssh session):

# cd /usb/sda1
# ls -al
drwxr-xr-x 3 root root 1024 Jan 1 17:28 .
drwxrwxr-t 4 root root 80 Jan 1 17:23 ..
-rwxr-xr-x 1 root root 85792917 Jan 1 17:28 debian.tgz
drwx------ 2 root root 12288 Jan 1 17:22 lost+found
#
# gunzip -c debian.tgz | tar xf -
#
# df -h .
Filesystem Size Used Available Use% Mounted on
/dev/sda1 483.7M 294.8M 164.0M 64% /usb/sda1
#
# ls -al
drwxr-xr-x 4 root root 1024 Jan 1 17:38 .
drwxrwxr-t 4 root root 80 Jan 1 17:23 ..
drwxr-xr-x 22 root root 1024 Jan 1 17:35 debian
-rwxr-xr-x 1 root root 85792917 Jan 1 17:28 debian.tgz
drwx------ 2 root root 12288 Jan 1 17:22 lost+found
#

Now, use the instructions from http://code.google.com/p/snake-os/wiki/Debian_Chroot

# mount -o bind /proc /usb/sda1/debian/proc
# mount -o bind /dev /usb/sda1/debian/dev
# mount -o bind /usb/sda1 /usb/sda1/debian/mnt/sda1
# chroot /usb/sda1/debian/
sh-3.1#
sh-3.1#
sh-3.1# ls -al
total 31
drwxr-xr-x 22 root root 1024 Jan 1 13:35 .
drwxr-xr-x 22 root root 1024 Jan 1 13:35 ..
-rw------- 1 root root 357 Jul 28 2008 .bash_history
drwxr-xr-x 2 root root 3072 Jan 1 13:31 bin
drwxr-xr-x 2 root root 1024 Oct 31 2006 boot
drwxrwxrwt 4 root root 3760 Jan 1 13:22 dev
drwxr-xr-x 42 root root 3072 Jan 1 13:31 etc
drwxr-xr-x 3 root root 1024 Jan 1 13:31 home
drwxr-xr-x 2 root root 1024 Jul 28 2008 initrd
drwxr-xr-x 9 root root 5120 Jan 1 13:31 lib
drwx------ 2 root root 1024 Jul 27 2008 lost+found
drwxr-xr-x 2 root root 1024 Jul 28 2008 media
drwxr-xr-x 3 root root 1024 Jan 1 13:31 mnt
drwxr-xr-x 2 root root 1024 Jul 28 2008 opt
dr-xr-xr-x 40 root root 0 Jan 1 1970 proc
drwxr-xr-x 4 root root 1024 Jan 1 13:31 root
drwxr-xr-x 2 root root 3072 Jan 1 13:31 sbin
drwxr-xr-x 2 root root 1024 Sep 16 2008 selinux
drwxr-xr-x 2 root root 1024 Jul 28 2008 srv
drwxr-xr-x 2 root root 1024 Jan 31 2007 sys
drwxrwxrwt 3 root root 1024 Jan 1 13:33 tmp
drwxr-xr-x 10 root root 1024 Jan 1 13:33 usr
drwxr-xr-x 13 root root 1024 Jan 1 13:35 var
sh-3.1#
sh-3.1# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 484M 293M 167M 64% /
tmpfs 484M 293M 167M 64% /lib/init/rw
sysfs 484M 293M 167M 64% /sys
df: `/proc/bus/usb': No such file or directory
df: `/dev/shm': No such file or directory
devpts 1.0M 0 1.0M 0% /dev/pts
sh-3.1#

Voila! A substantially more complete Linux setup than is available under SnakeOS itself.

NOTE: Needed to edit /etc/resolv.conf so that my local DNS server (10.1.1.3) is used for name resolution. Having done that I was able to use “apt-get install screen” to pull down the “screen” application (and automagically update some other packages).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: