Install Optware (IPKG) on QNAP TS-210 with QTS 4.x

With introduction of QTS 4.x:

  • there are a lot of changes in QNAP’s Control Panel, including the fact that “Application Servers” component is gone,
  • neither Optware nor IPKG or QPKG elements are available for download in the “App Center”.

This causes my “Installing Optware (IPKG) on QNAP TS-210” (6,5 year old!) article to be completely outdated.

Currently then only way to install Optware is to go through Manual instalation as described in QNAP Wiki.

Since I went through this guide and can confirm that it is working, I will be enough nasty to copy-paste that article here (removing stuff not related to QNAP TS-210 and fixing some bugs).

To go through these steps you need a shell access to your QNAP. Using the PuTTY is the most obvious answer.

But wait! There’s a much better way. QNAP introduced a gem called “shellinabox“, available in App Center (or here or here). I strongly recommend to use it, because with it, you need a web browser!

Install Optware

Create the required directories:

mkdir -p /share/MD0_DATA/optware/opt
mkdir /share/MD0_DATA/optware/ipkglib
cd /; ln -sf /share/MD0_DATA/optware/ipkglib /usr/lib/ipkg

Create a symbolic link to /opt:

rm -rf /opt
cd /; ln -sf /share/MD0_DATA/optware/opt /opt

Check, if /opt is correctly symlinked:

cd /
ls -la

You should see (among other results, i.e. folder contents):

opt -> /share/MD0_DATA/optware/opt/

Download and the IPKG file package:

cd /share/MD0_DATA/Download
wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk 
tar -xOvzf ipkg-opt_*_arm.ipk ./data.tar.gz | tar -C / -xzvf -

Change configuration file

Run Vi:

vi /opt/etc/ipkg.conf

Add following line to the end of file:

src cs05q3armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable

Then:

  • Save /opt/etc/ipkg.conf file — hit Esc, type :w and confirm with Enter.
  • Quit VI — hit Esc, type :q and confirm with Enter.

You may want to execute cls to clean the console screen.

Update Optware

Update the package list:

/opt/bin/ipkg update

You should see:

Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/Packages 
Updated list of available packages in /opt/lib/ipkg/lists/cs05q3armel 
Successfully terminated.

Verify installation

Do this by installing Midnight Commander:

cd /share/MD0_DATA/optware 
/opt/bin/ipkg update 
/opt/bin/ipkg install slang 
/opt/bin/ipkg install mc --tmp-dir=/share/MD0_DATA/

Run Midnight Commander:

/opt/bin/mc

Alter path to lift the need of providing full paths:

PATH=$PATH:/opt/bin:/opt/sbin:"$PATH"

Preserve configuration

You will have to repeat some steps after each reboot of QNAP. To handle this we will modify autorun script.

Create (mount) autorun.sh:

mount /dev/mtdblock5 -t ext2 /tmp/config 
cd /tmp/config 

Run Vi:

vi autorun.sh

Add following lines to the end of file:

rm -rf /opt
ln -sf /share/MD0_DATA/optware/opt /opt
echo "export PATH=$PATH:/opt/bin:/opt/sbin" >> /etc/profile

Then:

  • Save /opt/etc/ipkg.conf file — hit Esc, type :w and confirm with Enter.
  • Quit VI — hit Esc, type :q and confirm with Enter.

You may want to execute cls to clean the console screen.

Make autorun.sh executable and unmount it (very important!):

chmod +x autorun.sh
cd /
umount /dev/mtdblock5

For some reason sometimes Vi prevents you from modifying autorun.sh, opening it in some kind of weird read-only mode. You can avoid this by editing this file in mcedit that ships with Midnight Commander (assuming you did Optware verification and installed it).

Summary

That’s all folks! Reboot your QNAP to see, if everything works just fine after restart.

More details and some additional information can be found in the original article.

13 comments on “Install Optware (IPKG) on QNAP TS-210 with QTS 4.x

  1. Sam

    Wow! made my life sooooo much easier !! thanks a million ! Installed it on a T-112.

    Still i seem to have trouble getting ipkg to work after a reboot ?… Any ideas?

      1. Sam

        No problemo, thanks for taking the time to answer. For the moment, I’ll just avoid rebooting maybe ? lol
        Thanks again for a super article !

    1. Karin

      I get the following error, when I try to execute /opt/bin/ipkg update
      -sh: /opt/bin/ipkg: cannot execute binary file

      Should I use sudo

      1. admin

        I don’t know and I don’t have any possibility of checking this now.

        But, from what I remember, sudo isn’t even enabled / implemented in quite very limited version of Linux under TS-210.

  2. Sam

    Found a fix to my problem. The default volume name on T-112 is HDA_DATA.
    Replaced MD0_DATA with HDA_DATA, and install / config persists after reboot. yay !
    Also checked “Run user defined processes during startup” in ControlPanel -> Hardware -> “General tab” on Firmware 4.3.3.
    Cheers !

  3. admin

    Yeah, you are correct. TS-112 (and other TS-1XX devices) is a single-bay NAS and uses HDA_DATA in QNAP’s terminology. While TS-210 is two-bay NAS and thus uses MD0_DATA (and MD1_DATA, under certain RAID configurations). This is mentioned in the original article, but I have removed this from here since this article is for TS-210 specifically. Great, that you managed to figure this out yourself and resolve your issue. Cheers!

  4. Rich Shumaker

    I am sure this a NOOB issue when i run “/opt/bin/ipkg update” I get an error cannot execute binary file I am on a TS-251+ running firmware 4.4.3.1354 – I am sure that I did something wrong except I wanted to find out if there was a NOOB fix, heheh. Thanks again for your help.

    1. admin

      As for typo, thanks for pointing this out, corrected. As for your question, sorry, I can’t help you. This is 1,5 year old post, I am no longer using TS-210 that way, I don’t know the answer.

  5. Diego

    Hello, i have this little problem…

    [/] # mount /dev/mtdblock5 -t ext2 /tmp/config
    mount: wrong fs type, bad option, bad superblock on /dev/mtdblock5,
    missing codepage or other error
    In some cases useful info is found in syslog – try
    dmesg | tail or so

    any ideas? sorry i am a noob

    1. admin

      For some reason you are trying to mount configuration file (config) and you are trying to mount it from a temporary location (tmp, usually a memory).

      I don’t know what you are trying to achieve, but this isn’t going to work as configuration file stored in memory for sure doesn’t have Ext2 file system.

      This issue has nothing to do with QNAP (it is a general Linux knowledge), your expectations are unclear (what do you want to achieve) and this is a hobby blog, not a support. So, sorry, but I am unable to help you any more.

Leave a Reply