Skip to content

Instantly share code, notes, and snippets.

@marlun78
Created March 4, 2014 16:26
Show Gist options
  • Save marlun78/9349792 to your computer and use it in GitHub Desktop.
Save marlun78/9349792 to your computer and use it in GitHub Desktop.
# How to install `ipkg` on a Synology DS214
After a couple of days of trying to get `ipkg` woking on my DS214 I found [this article](https://github.com/trepmag/ds213j-optware-bootstrap) by [trepmag](https://github.com/trepmag). It is written for the DS213j, but it’s been working for me and [others](https://github.com/alberthild) for the DS214 too.
I have done some minor changed to clarify some things, but if you are a Linux guy (unlike me) my changes might be of no use to you.
## Guide
### SSH
You need to have enabled `ssh` on your DiskStation. Then open up your terminal and type:
```bash
$ ssh root@[your-ds-ip]
```
Read more about how to setup SSH on your DiskStation [here](http://forum.synology.com/wiki/index.php/Enabling_the_Command_Line_Interface).
### Create optware root directory
```bash
$ mkdir /volume1/@optware
$ mkdir /opt
$ mount -o bind /volume1/@optware /opt
```
### Setup ipkg
```bash
$ feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
$ ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
$ wget $feed/$ipk_name
$ tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
$ mkdir -p /opt/etc/ipkg
$ echo "src cross $feed" > /opt/etc/ipkg/feeds.conf
```
(Source: http://www.nslu2-linux.org/wiki/Optware/HomePage)
### Set PATH
Open `/etc/profile`:
```bash
$ vi /etc/profile
```
Type `i` to enable insertion mode. See more `vi`-commands [here](http://forum.synology.com/wiki/index.php/Basic_commands_for_the_Linux_vi_Editor).
Add `/opt/bin:/opt/sbin:` to the `PATH` variable.
Then press `ESC` and press `ZZ` to save and exit.
If you are signed in as `root` as I was, you need to do the same to the `/root/.profile` file - then:
```bash
$ source /root/.profile
```
### Create init scripts
The following steps will allow to automatically bind the /volume1/@optware directory to /opt and trigger the /opt/etc/init.d/* scripts.
Create the /etc/rc.local (chmod 755):
```bash
$ touch /etc/rc.local
$ chmod 755 /etc/rc.local
$ vi /etc/rc.local
```
Insert:
```bash
#!/bin/sh
# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start
```
Then press `ESC` and press `ZZ` to save and exit.
Create the `/etc/rc.optware` file (chmod 755):
```bash
$ touch /etc/rc.optware
$ chmod 755 /etc/rc.optware
$ vi /etc/rc.optware
```
Insert:
```bash
#! /bin/sh
if test -z "${REAL_OPT_DIR}"; then
# next line to be replaced according to OPTWARE_TARGET
REAL_OPT_DIR=/volume1/@optware
fi
case "$1" in
start)
echo "Starting Optware."
if test -n "${REAL_OPT_DIR}"; then
if ! grep ' /opt ' /proc/mounts >/dev/null 2>&1 ; then
mkdir -p /opt
mount -o bind ${REAL_OPT_DIR} /opt
fi
fi
[ -x /opt/etc/rc.optware ] && /opt/etc/rc.optware
;;
reconfig)
true
;;
stop)
echo "Shutting down Optware."
true
;;
*)
echo "Usage: $0 {start|stop|reconfig}"
exit 1
esac
exit 0
```
(source: a working optware env)
I had trubbles copy/paste this code from Github and insert it into `rc.optware` with the `vi` editor and I had to go line by line to get it in correctly.
### Finaly
Reboot the DiskStation and you should be done!
As I said, I’m not a Linux guy, so if you spot a misstake, please let me know.
I hope this helps!
Good luck!
@mjanssen
Copy link

Thanks man! Got it working now (:

@mattstein
Copy link

Thanks for this!

@krichter722
Copy link

In the referenced howto the addition to PATH is done at the beginning, i.e. PATH=/opt/bin:/opt/sbin:$PATH (it's not clear in the instructions above, although the string to add ends with : which is a clue). Thanks for the link!

@erichlf
Copy link

erichlf commented Jun 20, 2014

You don't actually need to restart; the final steps should be something like
''' bash
$ . /root/.profile
$ /etc/rc.optware start
$ ipkg update
"""
Now you are up and running.

@hobbsy
Copy link

hobbsy commented Jul 29, 2014

would this work with a DS414? (Marvell Armada XP armv7l)

@sistecs
Copy link

sistecs commented Aug 8, 2014

hi thanks, but it doesnt work on my diskstation 214+

if I type
'''bash
$ ipkg update
'''

there is ipkg:not found
Can you help me

@mark534
Copy link

mark534 commented Aug 31, 2014

hi sistecs,

come today along the same problem. Please check your $PATH variable (echo $PATH).
type line 55 as described above. Then do

$ vi /root/profile

and add the same content as in /etc/profile.
After ZZ command verify with cat. Hope this helps.

@benbuckman
Copy link

Thank you @marlun78 and everyone else! I wish Synology made this much simpler.

@humpedli
Copy link

Thanks, it's working!

@jacqinthebox
Copy link

Works brilliantly! Thanks for your efforts.

@koiuo
Copy link

koiuo commented Jan 24, 2015

Thanks for the guide. It is very precise.

Wondering, whether anyone have been able to overcome DS214 feature where all changes to filesystem are rolled back on reboot.

@nickzse
Copy link

nickzse commented Feb 27, 2015

Thank you from a RS814 owner.

@zanzara
Copy link

zanzara commented Mar 25, 2015

Thanks , it's working also for me on a DS214+

@mrtim500
Copy link

mrtim500 commented Jun 2, 2015

Thanks, works on DS214+ here as well

@JohnMorales
Copy link

I also had trouble pasting using vi, instead I posted the contents of the rc.optware

then wget the whole file:

( cd /etc; wget https://gist.githubusercontent.com/JohnMorales/aa78405fa9acbf797c4d/raw/cea52c9966fc48031d4207729f6c10c7da1b2683/rc.optware && chmod 755 /etc/rc.optware ) 

lines 81-120 can be replaced with the one liner above

@frosty84
Copy link

frosty84 commented Oct 5, 2015

Works flawlessly for DS214+, thank you.

@wler
Copy link

wler commented Oct 10, 2015

Hello, I followed the procedure for a new DS214, but when issuing "ipkg update", then I get:

Downloading /Packages
An error ocurred, return value: 1.
Collected errors:
ipkg_download: ERROR: Command failed with return value 1: `wget --passive-ftp -q -P /opt/ipkg-3sK5uI /Packages'

I checked for the path, and indeed it starts with /opt/bin:/opt/sbin:/sbin... as it is supposed to do.
However, there is no other wget besides the original one which is in /usr/bin. And there
is no /opt/sbin directory whatsoever (?)
So how is it suppposed to work?

Thanks for help!

@klein0r
Copy link

klein0r commented Jan 7, 2016

Worked perfect on my DS214+
Thank you very much :)

@tadeub
Copy link

tadeub commented Feb 17, 2016

Can you guys help me?

i got the error when starting optware:
/etc/rc.optware: exit: line 31: Illegal number: 0

Here is my rc.optware output:

! /bin/sh

if test -z "${REAL_OPT_DIR}"; then

next line to be replaced according to OPTWARE_TARGET

REAL_OPT_DIR=/volume1/@Optware
fi

case "$1" in
start)
echo "Starting Optware."
if test -n "${REAL_OPT_DIR}"; then
if ! grep ' /opt ' /proc/mounts >/dev/mull 2>&1 ; then
mkdir -p /opt
mount -o bind ${REAL_OPT_DIR} /opt
fi
fi
[ -x /opt/etc/rc.optware ] && /opt/etc/rc.optware
;;
reconfig)
true
;;
stop)
echo "Shutting down Optware."
true
;;
*)
echo "Usage: $0 {start|stop|reconfig}"
exit 1
esac

@afrench
Copy link

afrench commented Mar 20, 2016

working on my DS214+

for those who haven't heard, ipkg is no longer supported.

I'm looking at zyxmon's replacement Qnapware as the next package manager.

Let me know if you've tried on the DS214+.

https://forum.synology.com/enu/viewtopic.php?t=95346

Awesome.

@robotsyte
Copy link

HI dear,

I have a DS116, and aI followed your instruction, to install ipkg. I think I did everything same like you, but when i write ipkg update I got an error: ipkg: error while loading shared libraries: /opt/lib/libc.so.6: internal error

What do you think, what shuld I do know?

Thanks
Robert

@tolidano
Copy link

@FlorianCassayre
Copy link

Awesome, the detailed steps helped me install it on my station. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment