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.

Installing Optware
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
--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...
Connecting to wizjos.endofinternet.net||: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
1227+1 records in
1227+1 records out
Creating temporary ipkg repository...
Installing optware-bootstrap package...
Unpacking optware-bootstrap.ipk...Done.
Configuring optware-bootstrap.ipk...Modifying /etc/rc.local
Installing ipkg...
Unpacking ipkg-opt.ipk...Done.
Configuring ipkg-opt.ipk...WARNING: can't open config file: /usr/syno/ssl/openssl.cnf
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.


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:

NAS> reboot

Managing packages
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.
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.

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.

Removing packages is just as easy as installing:

NAS> ipkg remove iperf 
Removing package iperf from root...
Successfully terminated.

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.

Uninstalling Optware
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> reboot

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


Stefan said…
Nice! I'm waiting on my new DS211+ to be delivered and I found your article. Thanx!
Casper Bang said…
You're going to love it I think! :)
Stefan said…
Works like a charm!
Running bind9 right now for ipv6 :)

Anonymous said…
Very nice article. Much appreciated!
I had a bit of a hiccup when installing the bootstrap in that using /tmp or /volume1/@tmp to download and run the script resulted in an incomplete installation and a message to rm /@opt and /usr/iforgetnow, *reboot*, and restart the bootstrap script. Of course rebooting cleans out both of those directories. It only took half-dozen tries for me to realize the problem. duh. I have a DS211+ with DSM 3.2-1955. Thanks again. LSLetner
Anonymous said…
It works fine, but I'm not able to install mono. when I issue the command "ipkg list mono" I can't find any package :(
Casper Bang said…
Anonymous: You can see the package repository here: http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/

Try installing with "ipkg install mono_2.4-1_arm"
Dirk said…
Great, I just got it working on a DS212+II. Now I have a little server at home again :)

Thanks for your helpful article!

Best regards, Dirk
Lars Hartvig said…
I can't get this working after updateing to DSM4... I hope there is a solution to this.

Casper Bang said…
I have not tried it on DSM4, but will look into it soon.
svar said…
Trying on my 1511+ running DSM4.0, everything seems to be ok, catalogs are there and stuff but then I runn ipkg I get
-ash: ipkg: not found
Unknown said…
You have to redo the symbolic link for the opt directory, and reboot.

The link gets broken with the update.
Unknown said…
mono is not in the ipkg repository anymore.

Any hints on creating the package manually?

It used to be one there, so the spec file must be somewhere
Casper Bang said…
Bummer, I've come to rely on C# for much of my open source hobby stuff. We should try to contact the ipkg maintainers.
Thanks, I had a problem that Optware prevented expansion of my volume after upgrading from 1TB to 3TB drives in a 207+ with RAID1.

I did not have to remove Optware but these console lines were sufficient:
NAS> /etc/rc.optware stop
NAS> umount /opt
Then going into the Storage Manager in DMS the button for handling the volume was no longer grayed out. Pressing it unveiled options to expanding the volume.
Once that is done I can simply restart the NAS
NAS> reboot now
or long press on the front panel power button.
(do not try that until the resize has completed !)
and it will soon be back online with both Optware and the expanded drives.
Mikael said…
Nice post!

Why do you want to remove the /volume1/@optware contents? Why is this a step in the procedure? What am I really removing? Just a bit nervous to remove hehe, please explain! :-)
Casper Bang said…
Mikael, it's part of the procedure for "Uninstalling Optware" as the header should indicate. ;)

Popular posts from this blog

Oracle SQLDeveloper 4 on Debian/Ubuntu/Mint

Beware of SQLite and the Turkish Locale

Rejsekort Scanner