For whatever reason it might happen, a module installation on a Thecus NAS Server won’t succeed. In such a case even removing the module might fail. In my case, I had to troubleshoot my Thecus N4200PRO with the latest 32-bit firmware 5.03.01.
Symptoms included a module which did not start at all with the message
Module[Mail Server]: Enable Fail.
and uninstalling the module stopping with the message
Module[Mail Server]: Uninstall Fail.
Even worse, re-installing the module was not possible as the server assumed the module already was installed and uploading the module manually failed as well.
To solve this kind of Mexican standoff you probably need to dig somewhat into the Thecus, though.
First of all make sure the SSH module (HiSSH) is installed and enabled.
You need to log in via the user root using the same password provided for your admin user, though.
macbookpro:~ andreas$ ssh 192.168.1.254 -l root email@example.com's password: firstname.lastname@example.org:~#
Depending what failed during your installation, only some of the following steps might be necessary to clean up the module.
Files related to the module might be found in the following three directories and need to be removed.
/raid/data/module/cfg/module.rc/ /raid/data/module/ /img/htdocs/module/
In case anything related to your module can be found there (such as Mailserver in my very case), you can remove them with one of the following commands.
rm -rf "/raid/data/module/cfg/module.rc/Mailserver.rc" rm -rf "/raid/data/module/Mailserver" rm -f "/img/htdocs/module/Mailserver"
Once all related files have been removed, you now head for the database and clean up the two affected tables. As sqlite won’t give any feedback about succeeded operations, makew sure entries are there before cleaning up and are gone afterwards.
email@example.com:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "SELECT * FROM module WHERE name = 'Mailserver'" Mailserver|2.00.02|Mail Server|No||md_mailServer.png|User|www/index.htm|User firstname.lastname@example.org:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "DELETE FROM module WHERE name = 'Mailserver'" email@example.com:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "SELECT * FROM module WHERE name = 'Mailserver'"
If the deletion works well, you should experience some delay after the delete statement was executed.
firstname.lastname@example.org:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "SELECT * FROM mod WHERE module = 'Mailserver'" Mailserver|1|type|Install Mailserver|1|ModuleRDF|Install Mailserver|1|ModuleRDFVer|1.0.0 Mailserver|1|Name|Mail Server Mailserver|1|Version|2.00.02 Mailserver|1|Description|Mail Server Mailserver|1|Key|Mailserver Mailserver|1|Authors|Davide Libenzi Mailserver|1|Thanks|XMail by Davide Libenzi Mailserver|1|WebUrl|http://www.xmailserver.org/Readme.txt Mailserver|1|UpdateUrl| Mailserver|1|Reboot|No Mailserver|1|Icon|md_mailServer.png Mailserver|1|Mode|User Mailserver|1|HomePage|www/index.htm Mailserver|1|MacStart| Mailserver|1|MacEnd| Mailserver|1|Show|0 Mailserver|1|Publish|1 Mailserver|1|Login|1 Mailserver|1|UI|User Mailserver|4|type|NAS Mailserver|4|TargetNas|Thecus Mailserver|4|NasProtol|N7700 Mailserver|4|NasVersion|5.00.00.12 Mailserver|5|type|NAS Mailserver|5|TargetNas|Thecus Mailserver|5|NasProtol|N5200 Mailserver|5|NasVersion|5.00.00.12 Mailserver|6|type|NAS Mailserver|6|TargetNas|Thecus Mailserver|6|NasProtol|N4100PRO Mailserver|6|NasVersion|5.00.00.12 Mailserver|8|type|DependCom Mailserver|8|DependName|MySQL_5 Mailserver|8|DependVer|2.0.0 Mailserver|8|DependUrl| email@example.com:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "DELETE FROM mod WHERE module = 'Mailserver'" firstname.lastname@example.org:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "SELECT * FROM mod WHERE module = 'Mailserver'"
Once both tables are cleaned, you might want to reboot the NAS.
The Mail Server module failed for me, as I did not install the MySQL Module before. Unfortunately, the installation did break somewhere in the middle leaving some tries in the database for me without the files being copied to the corresponding directories. Therefore, the uninstall.sh script was missing to get rid of the bricked module. As the Thecus user interface won’t let you re-install the module nor uninstalled it due to the missing script, there is only litte you can do without knowing about the internals of the server. With the few steps provided above, unblocking most of the modules should work as long as you are able to install the SSH module on you NAS.