search

Install a Package Manager (with example Midnight Commander)

If you want to add software to your GoFlex Home then the easiest way to do that is with a package manager, which is a software installer that takes care of the housekeeping tasks of adding new programs. I will show you how to install the Optware ipkg utility which then makes it easy to add programs from the repository. Optware allows you to add programs without upsetting your original firmware as it installs to its own location.


This post is based mostly on the instructions on the now defunct OpenStora.com site, so thanks to those guys. Although their instructions said to create opt in the /home directory, which is still on ubi0:rootfs (flash storage).
And just to be clear before we start, you won't be able to just add any Linux software.The program has to be compiled to work with the linux kernel and system architecture so only software in the repository can be expected to work and even some of that may not work if kernel components are missing.  
Take a look through http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/Packages to see if anything appeals to you before you start so you know if ipkg is worth your time. Apart from midnight commander, mediatomb, one of the available dynamic ip update clients (ddclientnoip, ez-ipupdate or inadyn), atop, mp3info, nano, transmission, vnstat, wakelan, gcc and samba36 are a few suggestions.

Update (Apr 2019) : some of the programs in the repository are already installed, so it is worth checking first using the whereis command. for example 
whereis rsync   rsync: /usr/bin/rsync
whereis openvpn  openvpn: /usr/sbin/openvpn /etc/openvpn /usr/share/openvpn


Procedure


As usual first login with SSH and become root user and follow the instructions below, commands you enter are in blue, output is in white 

Flash storage is very limited so we need set up the opt directory on the hard drive. 
Initially I created opt on the NTFS filesystem and it seemed to work but the NTFS drivers don't work very well with symbolic links and I had to re-install libraries a couple of times.
So to avoid those issues create an ext3 partition and put opt in that. 
The options are;
1. an ext3 formatted USB flash drive
2. resize the NTFS with /usr/sbin/ntfsresize and create a new partition table with /sbin/parted
3..create an ext3 image as a file on the NTFS filesystem. 

The first option seemed simplest and a FAT32 USB works fine with a USB splitter or unpowered USB hub together with an external USB hard drive. But an ext3 formatted USB won't mount automatically.The second option is a bit risky because if you get it wrong you can lose data, but It could be useful if you install an NFS server, so if you are partitioning a new drive consider creating an ext3 partition. 

I decided to go with option 3 - use an ext3 image.

First create a 1GB image file (that's probably bigger than needed given the whole operating system resides in 249MB, so make it smaller or bigger if you want by changing the block count. There's no significance to 1GB, it's just a nice round number).
Note the in front of .ext3_image to hide the file in directory listing

dd if=/dev/zero of=/mnt/eSata/.ext3_image bs=4k count=256000

256000+0 records in
256000+0 records out
1048576000 bytes (1.0 GB) copied, 11.8818 seconds, 88.3 MB/s

Next create the filesystem. mkfs will warn you that the object is not a device but type y to the proceed anyway? (y,n) prompt. 

/sbin/mkfs -t ext3 /mnt/eSata/.ext3_image

mke2fs 1.39 (29-May-2006)
/mnt/eSata/.ext3_image is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
128000 inodes, 256000 blocks
12800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=264241152
8 block groups
32768 blocks per group, 32768 fragments per group
16000 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Create a mountpoint
mkdir /home/0ext3img

Mount the ext3 image as a loop device
mount -o loop /mnt/eSata/.ext3_image /home/0ext3img

The mount will be lost on reboot so we need to make sure it gets mounted on boot. Create a text file named mountext3d which will be the boot script containing the command we just ran manually above. Creating the file in the oe-bootfinish/start.d directory will make it run on boot.
vi /etc/oe-initscripts/oe-bootfinish/start.d/mountext3d

Type I for  insert mode and type or copy/paste the line

mount -o loop /mnt/eSata/.ext3_image /home/0ext3img

ESC ZZ to save and exit

Make the mountext3d file executable

chmod a+x /etc/oe-initscripts/oe-bootfinish/start.d/mountext3d

Copy the contents of the existing /opt directory to the image. The /opt directory is probably empty but it doesn't hurt to copy the whole thing just in case.
cd /
cp -r /opt /home/0ext3img

delete the old /opt directory


rm -rf opt


create a symbolic link so any writes to /opt will go to the /home/0ext3img directory


ln -s /home/0ext3img /opt


Check that everything is set up correctly
df -h /opt
Filesystem            Size  Used Avail Use% Mounted on
/dev/loop0            985M  162M  774M  18% /home/0ext3img
(note that Used & Avail will be different on your machine as you haven't installed ipkg yet)

Now that the /opt directory is set up and mounts automatically on boot, go ahead and install ipkg. 

Create a directory ipkg in home and download the required files to it
cd ~
mkdir ipkg
cd ipkg
wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ipkg-opt_0.99.163-10_arm.ipk

--09:07:15--  http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ipkg-opt_0.99.163-10_arm.ipk

Resolving ipkg.nslu2-linux.org... 23.141.224.193
Connecting to ipkg.nslu2-linux.org|23.141.224.193|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 74474 (73K) [text/plain]
Saving to: `ipkg-opt_0.99.163-10_arm.ipk'
100%[====================================================================================================================================================================================================>] 74,474      68.4K/s   in 1.1s
09:07:19 (68.4 KB/s) - `ipkg-opt_0.99.163-10_arm.ipk' saved [74474/74474]

unpack the files we need and move to opt

tar -xzf ipkg-opt_0.99.163-10_arm.ipk
cp ./data.tar.gz /data.tar.gz
cd /
tar -xzf data.tar.gz

Remove the data file rm  data.tar.gz

configure ipkg source

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

then update package list

/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.

That's it.
You can delete the temporary ipkg directory from the home folder if you like with 
cd ~
rm -rf ipkg

Now you should be able to get a list of packages available to install with
/opt/bin/ipkg list


If you want to uninstall a package use;
/opt/bin/ipkg remove package name


Example:  install Midnight Commander

Midnight Commander (mc) is a visual file manager. To install it just use;

/opt/bin/ipkg install mc

Installing mc (4.7.5.5-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/mc_4.7.5.5-1_arm.ipk
package slang suggests installing pcre
package slang suggests installing libpng
Installing glib (2.20.4-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/glib_2.20.4-1_arm.ipk
Installing slang (2.2.3-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/slang_2.2.3-2_arm.ipk
Installing e2fslibs (1.41.14-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/e2fslibs_1.41.14-1_arm.ipk
Configuring e2fslibs
Configuring glib
Configuring mc
Configuring slang
Successfully terminated.


To run it

/opt/bin/mc -a  (the -a flag ignores line characters and looks better when run in PuTTY)



screenshot MC in PuTTY