Optware/ipkg on Synology DS211+
Note that the following covers the DS211+ device, which is characterized by being based on the Marvell Kirkwood mv6282 ARM core (1.6Ghz version of 1.2Ghz mv6281). AFAIK the content of this blog entry should be equally applicable to all DS211 variations, but you should consult the Synology wiki for your device to be certain.
While quite feature rich out-of-the-box, developer types will likely want to make their NAS do even more, either out of a real need or just to tinker. For instance, I eventually plan to connect my USB weather station and generate live charts. Because of the modding desire, Synology has a faily comprehensive wiki about the subject. To make a long story short, ease of modding is greatly assisted by the possibility of installing Optware package manager.
Optware (ipkg) is an online package system a la what you may know from Debian/Ubuntu. This makes it easy to locate, install and uninstall compiled binaries (*.ipk) through the command-line.
Bootstrapper and Optware packages are maintained by the NSLU2-Linux community for use with various modifiable hardware devices incl. many Synology products. The installation procedure simply involves you downloading and installing the Optware-bootstrapper for your NAS. Here's what I wrote while logged in as root via SSH/telnet, to get it working.
Download the Optware bootstrapper:
NAS> cd /volume1 NAS> wget http://wizjos.endofinternet.net/synology/archief/syno-mvkw-bootstrap_1 .2-7_arm-ds111.xsh --22:58:07-- http://wizjos.endofinternet.net/synology/archief/syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh => `syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh' Resolving wizjos.endofinternet.net... 184.108.40.206 Connecting to wizjos.endofinternet.net|220.127.116.11|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 251,866 (246K) [text/plain] 100%[====================================>] 251,866 435.14K/s 22:58:08 (434.50 KB/s) - `syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh' saved [251866/251866]
Start the installation:
NAS> sh syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh Optware Bootstrap for syno-mvkw. Extracting archive... please wait bootstrap/ bootstrap/optware-bootstrap.ipk bootstrap/wget.ipk bootstrap/bootstrap.sh bootstrap/ipkg.sh 1227+1 records in 1227+1 records out bootstrap/ipkg-opt.ipk Creating temporary ipkg repository... Installing optware-bootstrap package... Unpacking optware-bootstrap.ipk...Done. Configuring optware-bootstrap.ipk...Modifying /etc/rc.local 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. BusyBox v1.16.1 (2011-04-08 10:13:55 CST) built-in shell (ash) Enter 'help' for a list of built-in commands. NAS>Note, if you get the message "Error: CPU not Marvell Kirkwood, probably wrong bootstrap.xsh", this is likely due to a too agressive sanity check (mv6281 but not mv6282) in the install script. If the output of the command "cat /proc/cpuinfo" mentions a "Feroceon" CPU, then you may safely open up the file "/volume1/bootstrap/bootstrap.sh" and edit line 21, changing "Feroceon-KW" to just "Feroceon", and run the script manually with "sh /volume1/bootstrap/bootstrap.sh".
The above will install a boot hook and create the directories /volume1/bootstrap and /volume1/@Optware where package manager and installed packages will reside. The content in /volume1/@Optware can also be found in /opt, due to an Optware bind mount requirement you can verify by invoking the mount command:
NAS> mount | grep @optware /volume1/@optware on /opt type bind (bind)Now reboot the NAS:
After a reboot, you can update the list of packages with:
NAS> ipkg update Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/Packages.gz Inflating http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/Packages.gz Updated list of available packages in /opt/lib/ipkg/lists/cross Successfully terminated. NAS>You can list all packages with "ipkg list" or search specific packages with "ipkg list [wildcard]".
NAS> ipkg list cpu* cpufrequtils - 006-2 - To make access to the Linux kernel cpufreq subsystem easier for users and cpufreq userspace tools, a cpufrequtils package was c Successfully terminated. NAS>
To install a package, simply type "ipkg install [name]". You may also browse the available packages by accessing the repository directly from within a browser.
NAS> ipkg install iperf Installing iperf (2.0.4-1) to root... Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/iperf_2.0.4-1_arm.ipk Configuring iperf Successfully terminated. NAS>Removing packages is just as easy as installing:
NAS> ipkg remove iperf Removing package iperf from root... Successfully terminated. NAS>To make sure all installed Optware packages are up to date:
NAS> ipkg upgrade Upgrading grep on root from 2.7-1 to 2.8-1... Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/grep_2.8-1_arm.ipk Configuring grep update-alternatives: Linking //opt/bin/grep to /opt/bin/grep-grep update-alternatives: Linking //opt/bin/egrep to /opt/bin/grep-egrep update-alternatives: Linking //opt/bin/fgrep to /opt/bin/grep-fgrep Successfully terminated. NAS>
To my knowledge, there isn't a one-liner for uninstalling the Optware system. It involves stopping the Optware service, unmounting the /opt bind mount, deleting the folder/files, editing the Linux service script and rebooting:
NAS> /etc/rc.optware stop NAS> umount /opt NAS> rm -rf /volume1/@optware NAS> rm -f /etc/rc.optware NAS> echo -e "#!/bin/sh\n" > /etc/rc.local NAS> rebootNote that the above wipes the rc.local script. If you have added custom stuff beyond just Optware, you should edit out the Optware stuff manually!
Of course, there aren't as many packages available as one would like, but it's still impressive that you can install Mono, Java, Python, Perl, Lua etc. on a small NAS device just with a single command. Hope this entry helps others get to hacking on their Synology device.