How to enable and configure Optware during start of NAS server
There was unpleasant surprise for me that command for running nano editor did not work on my NAS server QNAP TS-419P. I had no time to investigate causes, so I had to use vim to complete task, but after its completion, I’ve returned to the problem.
Nano editor is one of popular packages which extends capabilities of your NAS server. These packages are available for QNAP NAS servers via Optware IPKG system. Therefore I tried to use ipkg command to discover a probable problem with packages, however even ipkg did not work. It did not work because whole /opt directory was not simple available, ouch! How it is possible? I don’t know, maybe the newest firmware 3.8 has some bugs, but it does not matter, I want to bring ipkg back to the operation.Simple disabling and enabling Optware on the QPKG Center in the web administration solved issue, however only temporarily, the problem was here again after rebooting NAS server. So, research on the web started.
The following is my solution for this problem derived from QNAPedia Community wiki page. I slightly personalize the scripts mentioned there to my NAS configuration. This solution also enable the possibility to make customized Optware configuration. Just modify content of autorun.sh for your purposes.
At first, you need to create autorun.sh. Log to the server (preferable via ssh) and run following commands.
# mount /dev/mtdblock5 -t ext2 /tmp/config
# cd /tmp/config
# vi autorun.sh
Inside vim editor, please add to the following lines to the file, then save and close.
rm -rf /opt
ln -sf /share/MD0_DATA/.qpkg/Optware /opt
echo “export PATH=$PATH:/opt/bin:/opt/sbin” >> /etc/profile
Finally, please make autorun.sh executable and do not forget to unmount!
# chmod +x autorun.sh
# cd /
# umount /dev/mtdblock5
Now, you are ready to reboot NAS server. Wait some time after restart to get enough time for running all services, log on the server via telnet or ssh and run ipkg –version command. You should see following output.
ipkg version 0.99.163
If not, something went wrong, probable you could made some mistake in the script or you could have different organization of directories on your server.