Synology Script to automate IPKG installation on Synology

Installing ipkg is not difficult, but I hate to do it manually each time I (re)install a Synology... So, here attached is a script to install it automatically.

Click to Read More

First Installation:

  1. Copy on your NAS the script attached at the bottom of this post (Ex.: into \\<YourSyno>\web\admin as used for the illustration here after).
  2. Connect as root on your NAS (Ex.: via telnet using the command 'telnet <YourSyno>', the login 'root' and the password of your 'admin' account)
  3. Execute the script (Ex.: use the command 'sh /volume1/web/admin/')
  4. Check which processor your have on your NAS and select the right option accordingly. The script will show you the cpu found using 'cpuinfo'. But you can double-check here (NB.: I have a DS713+ which is currently not listed. I didn't test ipkg for the other versions).
Automatic Installation of Ipkg

Automatic Installation of Ipkg

You can now use ipkg directly in a shell or via the (really) great UI named "IpkgGUI". This one is available as a Community Package from Add "" as a Package Source in the Package Center's settings pane and install IpkgGUI.

Ipkg GUI

Ipkg GUI


If ipkg is already installed, the script will remove it automatically and reboot the NAS before proceeding further with the installation (A reboot takes a bit more than one minute to shutdown and a bit more than two minutes to restart on my DS 713+). After the reboot, thanks to a script inserted into /etc/rc.local, the setup will continue automatically.

Automatic Installation of Ipkg With Reboot

Automatic Installation of Ipkg With Reboot

Installation status:

(After the reboot, reconnect to the NAS). You can now check the status of the setup in its log, using the command: cat /root/ipkg.log. The output should looks like this:

[Mon Dec 15 17:34:44 CET 2014] Installing IPKG...
Optware Bootstrap for syno-i686.
Extracting archive... please wait
Creating temporary ipkg repository...
Installing optware-bootstrap package...
Unpacking optware-bootstrap.ipk...Done.
Configuring optware-bootstrap.ipk...Done.
Installing ipkg...
Unpacking ipkg-opt.ipk...Done.
Configuring ipkg-opt.ipk...Done.
Removing temporary ipkg repository...
Installing wget...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Installing wget (1.12-2) to root...
Configuring wget
Successfully terminated.
Creating /opt/etc/ipkg/cross-feed.conf...
Setup complete.

Notice: after the setup of ipkg, this one is upgraded and updated once automatically.

PS.: If you don't choose the right version of the boostrap, the installation of ipkg will fail. While trying to run it, you could see errors like "line 1: syntax error: unexpected word (expecting ")")". Try to install the right package. The script should delete the previous installation and install the new one as explained above.

Synology Touch your scripts! Don't be lazy...

I have just created a new shell script for my NAS. But its behavior is really weird. It seems that concatenating strings is actually overwriting them. Ex.:

echo $A$B

results in: 12cd

Click to read more

Also, redirecting any output into a file results in a new folder and an new empty file, both with a weird name. Ex.:

echo Hello World &amp;gt; $FILENAME

results in a file named "outputFile" and a folder named "" ( beeing displayed as 'dots' in Windows Explorer!). Both are well located under /volume1/sharedFolder/ and visible in Windows Explorer. However the folder does not appear when executing 'ls -la' in a console on the NAS (only the file appears) and the only way to delete this folder is to execute 'rm -R /volume1/sharedFolder' in the console.

I quickly realized that this behavior was a consequence of creating the file on a Shared Folder of the NAS using the Windows Explorer's contextual menu "New">"Text Document"... Creating an empty file with the command "touch" directly in a console on the NAS does not suffer the same issues.

There is indeed at least one difference that I know between the file format of Unix and DOS: the return character which is 0x0A in Unix, while it is 0x0A, 0x0D in DOS (a.k.a /n in Unix and /r/n in DOS)

I realized that this was the issue because each empty line in the script was resulting in an error: ": not founde x:", x being the line number. Meaning that the "empty lines" were actually not empty (due to the /r).

Notice that the magic "touch" only works because I use next Notepad++ to edit the file. Indeed, this great freeware preserve the Unix file format while NotePad, WordPad, etc..., do not.

I did use the Windows Explorer's contextual menu to create the empty file because I was too lazy to create a new file with notepad++ and browse next for the target subfolder on the NAS where I had to save it :(

Otherwise, with the "Save As" of NotePad++, I would have been able to pick the right format: "Unix Script File" :)