Wednesday, May 15, 2013

Seagate GoFlex Home NAS - Installing a package manager

This comes with a longer story, so I'll try to keep it short. When researching which NAS to buy at the time I found the OpenStora Wiki going in detail on all the things that you can do with not only Netgear Stora, but also with Seagate GoFlex Home NAS, which made it very appealing to me for a small network server. So today, we're going to follow one of the tutorials and install a package  manager, in preparation for other things, like hopefully installing an SVN server :-)

A word of warning before we go on - if you are not comfortable with the Linux commands and all that, it's probably best to read up more before you do anything, as you might break your NAS system. The good news is that you might be able to factory reset it, but still it's something that you don't want to come to.

Update 2013-05-18


Although this should still work with it's problems (see end of the post), you should follow the new post for an alternative solution.

Preparation


Aside from the usual personal accounts, I've created a system account as an Administrator through the web interface. The reason for that is we're going to use it's GoFlex Home Personal directory which resides on the HDD to store things outside of the Flash drive - this is to avoid wear as well as running into space issues (df / shows it only has 50 MB left). Just as well you can use your own personal account if you want to.

SSH remote access


The OpenStora Easy Root Access wiki page covers it very well. As the article recommends, Putty for Windows or Ubuntu is a very good choice as it allows you to create a session you can reuse later - you can customize things like the font (Window > Appearance) or more useful the auto-login username (Connection > Data), as this is quite long and not that easy to type (USERNAME_hipserv2_seagateplug_XXXX-XXXX-XXXX-XXXX). You can find the product key on the bottom of the unit, or remotely after you logon through the web interface (http://goflex_home) see the About GoFlex Home link in the bottom left corner.

Installing the package manager


This is pretty much following the steps in the OpenStora Installing a package manager wiki page, with just a change around the relocation of the /opt to the HDD.

1. Switch to root access (ignore the audit error):
-bash-3.2$ sudo -E -s
Password:
audit_log_user_command(): Connection refused
bash-3.2# whoami
root
2. Move the /opt directory to the HDD and create a symbolic link to it:
bash-3.2# df /opt
Filesystem           1K-blocks      Used Available Use% Mounted on
ubi0:rootfs             216180    164508     51672  77% /

bash-3.2# mv /opt/ /home/system/GoFlex\ Home\ Personal/

bash-3.2# ln -sv /home/system/GoFlex\ Home\ Personal/opt/ /opt
create symbolic link `/opt' to `/home/system/GoFlex Home Personal/opt/'

bash-3.2# df /opt
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda             2930255996 471090240 2459165756  17% /home/system/GoFlex Home Personal
Additionally, we're going to allow everyone to read from the new location:
bash-3.2# chmod a+rx /home/system/
bash-3.2# chmod a+rx /home/system/GoFlex\ Home\ Personal/
bash-3.2# chmod a+rx /home/system/GoFlex\ Home\ Personal/opt/
3. Download and extract the ipkg package.
bash-3.2# cd /home/system/GoFlex\ Home\ Personal/

bash-3.2# wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ipkg-opt_0.99.163-10_arm.ipk
[...]
14:56:40 (80.4 KB/s) - `ipkg-opt_0.99.163-10_arm.ipk' saved [74474/74474]

bash-3.2# tar -xvf ipkg-opt_0.99.163-10_arm.ipk
./debian-binary
./data.tar.gz
./control.tar.gz

bash-3.2# tar -xvf data.tar.gz
./
./opt/
./opt/bin/
[...]

bash-3.2# rm control.tar.gz data.tar.gz debian-binary ipkg-opt_0.99.163-10_arm.ipk

bash-3.2# /opt/bin/ipkg -version
ipkg version 0.99.163

bash-3.2# echo src cs08q1armel http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable >> /opt/etc/ipkg.conf

bash-3.2# /opt/bin/ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/Packages
Updated list of available packages in /opt/lib/ipkg/lists/cs08q1armel
Successfully terminated

4. PATH variable (optional)

Finally, we're going to alter the PATH environment variable so you can run programs from /opt/bin and /opt/sbin, otherwise you'll have to always specify the full path - see the OpenStora wiki page.

It is probably a good idea to keep the existing SSH session and open up a new one to test the new PATH. This way you have a working session to fix things back, otherwise you'll loose direct access to system commands and you'll have to specify full paths for everything (I know it happened to me :)


Update 2013-05-17:


If you find on next reboot that ipkg fails with the message below, it appears to be a problem with the symbolic links on NTFS, see this thread here - they seemed to be valid when first extracted... Since they were links to each other, I will just duplicate the file to replace the links.

bash-3.2# ipkg
ipkg: error while loading shared libraries: /opt/lib/libipkg.so.0: file too short

bash-3.2# ls -la /opt/lib/
total 152
-rwxrwxrwx 1 apache users     82 May 17 23:45 1
drwxrwxrwx 1 apache users   4096 May 15 15:00 ipkg
-r-xr-xr-x 1 apache users     42 May 15 14:57 libipkg.so
-r-xr-xr-x 1 apache users     42 May 15 14:57 libipkg.so.0
-rwxrwxrwx 1 apache users 150260 Feb 15  2012 libipkg.so.0.0.0

bash-3.2# cp libipkg.so.0.0.0 libipkg.so
bash-3.2# cp libipkg.so.0.0.0 libipkg.so.0

bash-3.2# ipkg -v
ipkg version 0.99.163

No comments :

Post a Comment