Tuesday, July 06, 2010

Seagate Dockstar notes...

(or: Chad writes a practical post for once!)

The Seagate Dockstar's a variation of the Pogoplug, in turn Sheevaplug. woot.com recently had them for $20+5/ea ($65 for 3!) and buy.com has them for $25+0.

The Dockstar has reduced specs (128mb ram, 256mb flash, no RTC) from the original Sheevaplug, but multiple USB ports. Combined with a Gigabit Ethernet port it's a far more powerful version of the once-famous Linksys NSLU2 (aka Slug)

The first challenge is getting the conventional firmware out of the way so we can do truly useful things with it. It turns out that the default firmware only uses 32MB flash, leaving a nice 224MB jffs2 partition for a better Linux distro! there's a build of Debian Lenny here

My steps (largely cribbed from http://ahsoftware.de/dockstar/)

- Log in via ssh (root pw: sgxadmin)

- mount / -o remount,rw

- disable hbmgr in /etc/init.d/rcS. edit: this is very important, the dockstar firmware may auto-update and cut off ssh!

- mkdir /tmp/mnt

- mount /dev/mtdblock3 /tmp/mnt

Now I can extract the Lenny tarball - I put it on another machine and used netcat (nc -l -p5000 | tar -xvjf -) to put it into /tmp/mnt

After this there are two paths:

- run debian in a chroot with a ssh server on an alternate port. This means keeping the init from the original system running, but it's not too bad.

- Put a pivot_root/exec debian's /sbin/init and have the Debian system totally take over.

Debian Lenny notes:

- /var/cache/apt[/archives][/partial] must be a tmpfs since jffs2 is not mmap-able.

- debian/usr/sbin/chroot is static, so you don't need a chroot binary in the main system.

- By changing the sshd port to 2222 in /etc/ssh/sshd_config, you can ssh directly into debian

- you need these mounts:

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /tmp type tmpfs (rw)
none on /dev/shm type tmpfs (rw)
none on /dev/pts type devpts (rw)
none on /lib/init/rw type tmpfs (rw)
none on /var/cache/apt type tmpfs (rw)

- run "export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"" if chrooting in.

- After removing /var/cache/apt there's still 40MB (+ compression gain) in the large filesystem. Not bad.

update: here's an autostart script that gets the debian chroot+sshd up and running (assuming you change the ssh server port)

mount /dev/mtdblock3 /debian
mount none -t proc /debian/proc
mount none -t tmpfs /debian/tmp
mount none -t tmpfs /debian/dev/shm
mount none -t tmpfs /debian/var/cache/apt
mkdir /debian/var/cache/apt/archives
mkdir /debian/var/cache/apt/archives/partial
mount none -t sysfs /debian/sys
mount /dev /debian/dev -o bind
mount none -t devpts /debian/dev/pts
/debian/usr/sbin/chroot /debian /usr/sbin/sshd

The Debian chroot will start sometime after the stock distro's sshd, since mounting the jffs2 partition takes a while. There's plenty of free memory afterwards:

Pogoplug:~# free
total used free shared buffers cached
Mem: 126064 27040 99024 0 0 10792
-/+ buffers/cache: 16248 109816
Swap: 0 0 0



RonKJeffries said...

You might also mention that Dockstar does NOT have a real-time clock.

RonKJeffries said...


Your link to the Debian port is truncated.

happycube said...

fixed... and i figure ntpdate can cover up the lack of RTC easily enough.

RonKJeffries said...

Agree that ntp pretty much solves lack of real time clock. Just thought that mentioning that factoid was useful to someone just getting started.

Twinclouds said...

Is it possible to put the Debian installation on a USB driver and start from there and how?

happycube said...

Yeah, you can do the chroot procedure using a USB stick, although you'll probably want to add an if block to make sure it's actually there.