Sunday, April 12, 2015

Prepare your Synology NAS to install custom packages via ipkg

Objective


I wanted to use the bash-shell and a newer wget on my Synology DS209+II. There are no official packages from Synology provided, but I knew there is a way to install custom and optional packages via ipkg. Unfortunatelly ipkg must be so called bootstrapped, because it is already a custom package itself.

Motivation


As my Synology is mostly running 24/7, I wanted establish a custom download-script which is started and stopped as a cron-job at certain periods of time. The script itself uses some commands relying on a bash-shell, but the Synology default command shell is just the less powerful ash-shell. Also some of the wget-options I use in that script seem to be broken in the version of wget that my Synology has installed.

Prerequisites


  • DS209+II
  • Proper bootstrap script for your Synology NAS

Solution


Download the proper boostrap script


First you have to find out which processor is used on your specific Synology NAS.

Log into your Synology as root using ssh (e.g "ssh -l root DiskStation") and type the following command:

DiskStation$> cat /proc/cpuinfo

Doing so on my DS209+II printed the following information:

processor : 0
cpu : e500v2
clock : 1066.560000MHz
revision : 2.2 (pvr 8021 0022)
bogomips : 133.32
timebase : 66660000
platform : MPC8544 DS
model : MPC8544DS
Vendor : Freescale Semiconductor
PVR : 0x80210022
SVR : 0x80340011
PLL setting : 0x4
Memory : 512 MB
Memory : 512 MB

Now I know I have a Freescale PowerPC (e500v*), I can download the proper boostrap script here:

You can find a list of all bootstrap scripts here (column: "Optware-Pfad/IPKG"):
Processors used in Synology NAS Systems (German)

Now download the proper script and copy it to your Synology.

On the (still open) ssh connection "cd" into the folder where you stored the script and type (script name for your Synology type may differ!):

DiskStation$> sh syno-e500-bootstrap_1.2-7_powerpc.xsh

After you hit enter and you see something like this:

Optware Bootstrap for syno-e500.
Extracting archive... please wait
bootstrap/
bootstrap/bootstrap.sh
bootstrap/ipkg-opt.ipk
bootstrap/ipkg.sh
bootstrap/optware-bootstrap.ipk
bootstrap/wget.ipk
1330+1 records in
1330+1 records out

you already have installed an older version of ipkg.

Now you first have to remove this version, before installing the new one.

Backup your old ipkg configuration (only if you already have ipkg on your system)


If you have already installed ipkg and other custom packages via ipkg then make a backup of the following folders on you Synology:

  • /volume1/@optware
  • /usr/lib/ipkg

then remove all existing optware packages:

DiskStation$> rm -rf /volume1/@optware && rm -rf /usr/lib/ipkg

Afterwards, you must *reboot your Synology* and then restart the bootstrap script.

Re-Install ipkg


Again, log-into your Synology via ssh as root and type:

DiskStation$> sh syno-e500-bootstrap_1.2-7_powerpc.xsh

Now you should see a full install log:

Optware Bootstrap for syno-e500.
Extracting archive... please wait
bootstrap/
bootstrap/bootstrap.sh
bootstrap/ipkg-opt.ipk
bootstrap/ipkg.sh
bootstrap/optware-bootstrap.ipk
bootstrap/wget.ipk
1330+1 records in
1330+1 records out
Creating temporary ipkg repository...
Installing optware-bootstrap package...
Unpacking optware-bootstrap.ipk...Done.
Configuring optware-bootstrap.ipk...Setting up ipkg arch-file
Done.
Installing ipkg...
Unpacking ipkg-opt.ipk...Done.
Configuring ipkg-opt.ipk...WARNING: can't open config file: /usr/syno/ssl/openssl.cnf
Done.
Removing temporary ipkg repository...
Installing wget...
Installing wget (1.12-2) to root...
Configuring wget
Successfully terminated.
Creating /opt/etc/ipkg/cross-feed.conf...
Setup complete.

Update your $PATH variable, so that the ipkg can be found after reboot.
Therefore open the file $HOME/.profile and edit the line with your PATH:

PATH=/opt/bin:/opt/sbin:[the content that was already there]

Finally it's recommended to update your ipkg-package to ensure to use the newest version:

DiskStation$> ipkg update

Downloading http://ipkg.nslu2-linux.org/feeds/optware/syno-e500/cross/unstable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/syno-e500/cross/unstable/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/cross
Successfully terminated.

If you use "ipkg upgrade" instead of "ipkg update", also all already installed custom packages are upgraded, too.

Boostrap done. Now you can install optional packages via the ipkg command on your Synology.

References:

  1. https://www.naschenweng.info/2012/01/17/synology-dsm-4-0-beta-breaks-ipkg/

No comments:

Post a Comment