birds like wires

Search

Recovering a TeraStation

One happy TeraStation back in working order.

Recently, I had one of these land in my lap. Not literally, thankfully, as they weigh a ton and have pointy edges; regardless, I have one in my possession.

This particular box is an ARM-powered TeraStation Pro v2, and, as is the way with these things, it was broken. Retired from it’s backup duties, it had sat underneath a desk for some time with what I assumed would be a straightforward problem to fix. On applying some power it became obvious from the incessant beeping that drive 3 was kaput. So I had a little fight with it, swapping drives and breaking the cheap and superfluous little plastic clips on the carriers.

Eventually, I managed to make it appear happy by removing both drives 3 and 4 – then it got stuck booting and I pulled the plug. Powering back up I was treated to this happy little message on the screen:

TFTP MODE E06: Lost boot image

Well, at least that’s different problem to not knowing the admin password, I suppose.

Recovery with TFTP

When you see the E06 error, the TeraStation will sit with the IP address 192.168.11.150 and repeatedly try to fetch files from a TFTP server at 192.168.11.1. Thankfully, the way in which it does this is pretty sensible; so long as you have a TFTP server running on that IP address, and it’s hosting the files from a firmware update, it should fetch those files and spring back to life almost immediately. I used TFTP Server for Mac OS X, but there are numerous ones available for other platforms. The free TFTP from SolarWinds works well on Windows.

For the TS-H1.0TGL/R5 that I was working with, these are the firmware update files – just be sure to use v1.33 and not v1.35, otherwise you won’t be able to do the fun bit in a moment.

Also, remember that once the box has booted you will need to run the firmware update program from Windows. All you have done so far is boot the box over TFTP; it hasn’t saved that firmware anywhere, so if you power off, it’ll be TFTP mode all over again. I found it best to edit the lsupdater.ini file in the firmware update directory to contain this:

[Flags]
VersionCheck = 0

[SpecialFlags]
Debug=1

That enables a debug mode (accessed by right-clicking the title bar) which allows you to force a firmware update and format the drives at the same time. By this point I had found a replacement for Drive 3, so with all four drives alive, that’s what I chose to do. It takes it’s sweet time, but eventually (and after a few reboots) the TeraStation was alive!

I took a bit of time to set it up properly now, creating a RAID10 array and a share so people could use it. Very good.

Oh, look! Linux!

Did I promise a fun bit? Well, it comes in the form of acp_commander.jar.

There’s a very good NAS resource in the form of NAS-Central, without which this box would still be a footrest. The good people over there have developed acp_commander. This little Java program will open up Telnet access to your box, give you a blank root password and even install a few added extras to make your command line a little more useful. Back on my Mac it was a simple case of:

java -jar acp_commander.jar -t 192.168.11.150 -o -gui 1

Which puts the web interface back into English, as well as opening up the box. You can then:

telnet 192.168.11.150

Command prompt!

Because I did have some troubles with the automated add-ons installation, I just downloaded the addons.tar from here, copied it to the share I created earlier and decompressed it from there:

tar -C / -xvf /mnt/array1/<share name>/addons.tar

For everything to work properly, you’ll also need the libproc-3.2.6_arm9.tgz library file from here

cd /mnt/array1/<share name>
wget http://downloads.nas-central.org/Users/kaiten/libproc-3.2.6_arm9.tgz
tar -C / -zxvf libproc-3.2.6_arm9.tgz
ldconfig -v

You can then apply a couple of quick fixes, which sort out some potential permission problems:

chmod 666 /dev/null
chmod 644 /etc/profile
touch /var/log/lastlog
chmod 744 /var/log/lastlog

Probably sensible to set a root password with passwd root while you’re there.

So now you’re all done. Except, you don’t really want Telnet, do you?

Enabling and Maintaining SSH

First, create /etc/init.d/sshd.sh containing:

#!/bin/sh

#
# Start/stop the SSH daemon.
#

test -f /usr/local/sbin/sshd || exit 0

# this is used by daemonwatch (since fw 1.11-1a)
ACTIVE_FILE=/var/run/active_sshd

case "$1" in
start)
	echo "Start service: sshd"
	/usr/local/sbin/sshd -f /etc/sshd_config
	touch ${ACTIVE_FILE}
	;;
stop)
	echo "Stop service: sshd"
	killall sshd
	rm -f ${ACTIVE_FILE}
	;;
restart)
	$0 stop
	$0 start
	;;
*)
	echo "Usage: $0 start|stop|restart"
	exit 1
	;;
esac
exit 0

Then set execute permissions:

chmod 755 /etc/init.d/sshd.sh

Now make sure the configuration is correct. Your /etc/sshd_config should contain:

port 22
Protocol 2,1
PermitRootLogin yes
StrictModes yes
Subsystem       sftp    /usr/local/libexec/sftp-server

Then you need to add it to the startup routine. In /etc/init.d/rcS you’ll find a for loop called ‘Step 3’: immediately before the entry for ‘daemonwatch.sh’, add ‘sshd.sh’. It should look like this when you’re done:

echo "** step3 **"
for cmd in micon_setup.sh ... clientUtil_servd.sh lsprcvd.sh sshd.sh daemonwatch.sh cron.sh ltbootd.sh logchkd.sh
do
        exec_sh $cmd
done

Finally, get the system’s dameonwatch to keep it alive by adding this line to /etc/daemonwatch.list:

/var/run/sshd.pid       /var/run/active_sshd       /etc/init.d/sshd.sh restart

Then give the TeraStation a reboot.

Happy TeraStation

So now you have root access to your TeraStation and you can do anything you like with it, which is great. You’ve only got 128MB RAM and a 400MHz ARM CPU to play with, so I wouldn’t try running Folding@Home on it, but there are options.

For instance, you could install the ipkg package manager to add more things to your system. It’s as simple as this:

mkdir /mnt/array1/tmp
cd /mnt/array1/tmp
wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/teraprov2-bootstrap_1.2-7_arm.xsh
sh teraprov2-bootstrap_1.2-7_arm.xsh

Then you get all the usual ipkg update and ipkg install commands.

Or, if you’re a little jealous of the TeraStation Live with it’s media server, you could well and truly trump it by installing Logitech Media Server.

But that’s for another article.