Removing Failed Thecus Moule Installations

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

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.

Prerequisitees

First of all make sure the SSH module (HiSSH) is installed and enabled.

HiSSH Module

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
root@192.168.0.101's password:
root@127.0.0.1:~#

Cleaning Up

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.

root@127.0.0.1:~# /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

root@127.0.0.1:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "DELETE FROM module WHERE name = 'Mailserver'"

root@127.0.0.1:~# /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.

root@127.0.0.1:~# /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|

root@127.0.0.1:~# /opt/bin/sqlite /raid/data/module/cfg/module.db "DELETE FROM mod WHERE module = 'Mailserver'"

root@127.0.0.1:~# /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.

Conclusion

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.

sa-update

SpamAssassinFor quite a while my SpamAssassin installation for Windows won’t update anymore. It simply quit with some exit code 4. Unfortunately, SpamAssassin is running on this server for quite some time and often one simply forgets about systems that are up and running until they fail. Having a closer look at the error message it appeared that sa-update had some problems with some of the preconfigured channels.

C:\SpamAssassin>sa-update.exe -v --nogpg --channelfile UpdateChannels.txt
channel: no 'mirrors.khop-bl.sa.khopesh.com' record found, channel failed
channel: no 'mirrors.khop-general.sa.khopesh.com' record found, channel failed
channel: no 'mirrors.khop-sc-neighbors.sa.khopesh.com' record found, channel failed
Update failed, exiting with code 4

C:\SpamAssassin>if NOT EXIST .\share\3.003001\updates_spamassassin_org.cf EXIT /B 1

A look at the sa-update documentation reveals there might be a problem with downloading and extracting the updates.

An exit code of 4 or higher, indicates that errors occurred while attempting to download and extract updates.

As the sa-update.bat refers to a file called updatechannels.txt you probably find the failing channel entries there.

# see http://khopesh.com/wiki/Anti-spam#sa-update_channels
# for more information

updates.spamassassin.org
khop-bl.sa.khopesh.com
khop-general.sa.khopesh.com
khop-sc-neighbors.sa.khopesh.com

Digging a little bit deeper showed that the channels provided by Adam Katz at http://www.khopesh.com/ became unmaintained. Therefore, the easiest way to get rid of the failures is to remove the entries from the file for good. Eventually, this will leave you with only the official channel at updates.spamassasin.org.

Can’t Be Opened on Lion Easy Fix for Single Application

After installing Eclipse on Mac OS X, I was permanently told the app’s developer is not identifiers and the app can’t be started.

Can't be openend...

Better than turning off Gatekeeper and less annoying than CTRL-clicking the app all the time is simply to run

xattr -d com.apple.quarantine /applications/eclipse/eclipse.app

No side effect on security settings at all…

Fixing ASP.NET MVC 4 Web API 404

For a Web Service providing some REST-style URIs to access the data, I decided to use the ASP.NET MVC 4 Web API. Once developed, tested and deployed I experienced a mysterious 404 on my production server.

ASP.NET Web API 404

The Web API started originally as WCF Web API at CodePlex and is finally fully integrated within the latest .NET framework:

“ASP.NET Web API represents the joint efforts of the WCF and ASP.NET teams to create an integrated web API framework. You can get the bits and find articles, tutorials, samples and videos on the new ASP.NET Web API home page. All you have to do is to..”

The tutorials and examples for the ASP.NET Web API are overall easy to understand and you probably get  access to the technology very quickly. After I set up my first Web API, which worked absolutely perfect on Windows 8, developed using Visual Studio 2012 and tested with the IIS Express, I was not able to get the bits executed on the deployment server. It’s a Windows Server 2008 R2, IIS 7.5 and a whole bunch of stuff installed using the Web Platform Installer.

Make sure the .NET Framework is installed, probably you missed to install the 4.5 framework on the deployment server. As IIS is set up already, once again it is necessary to register ASP.NET for the latest framework using

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i

Even now, I got the 404. Eventually, I got the tip to check out how the routing of extensionless URLs work in ASP.NET. By adding

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    ...
</system.webServer>

to the web.config file of my Web API  the routing seems to work fine now.

MacBook Pro’s Bluetooth Gone Fishin’

Today, I spend literally hours in trying to fix a hardware problem on my MacBook Pro as the Bluetooth suddenly went fishing without saying anything to me. Said that, I run Apple’s Booot Camp with Mountain Lion and Windows 7 which makes troubleshooting sometimes easier, sometimes harder. As I turned on my MacBook Pro this morning my Microsoft Wireless Notebook Presenter Mouse 8000 (great device but a way too long name) mouse was – let’s say – working but not working. Left and right button and mouse movements worked fine but the mouse wheel as well as the middle button did not work at all. I followed some simple debugging rules from David Agan’s book Debugging The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems how to analyze faults in systems.

For the Impatient Ones

Jump to the very end of this article, do not learn anything, do not improve your analytic skill by one but see how to fix it.

Check The Plug

First, I checked the Microsoft IntelliPoint software (Still working? Latest version?) and it said there is no Microsoft Mouse connected.

No Microsoft Mouse Detected

Next step, I checked Windows Device Manager telling me here is a unknown device. Maybe Windows did not know, but I was pretty sure the device Windows did not want to know anymore today was the MacBook Pro’s Bluetooth chip.

Unknown Device

I checked the device properties and found that

“Windows has stopped this device because it has reported
problems. (Code 43)”

What kind of problems, you’ll probably never known.

Unknown Device Properties

If you dig a bit you’ll probably come along the TechNet entry for Error Code 43 saying

“A device driver notified the operating system that the device failed.”

With some years of experience in this kind of business, I tried of course

  • kicking the laptop (most of the time works quite fine with other people’s hardware)
  • rebooting several times
  • un- and re-installing the device drivers
  • running Windows’s Hardware and Device troubleshooting

Make it Fail

As nothing worked out for me, I rebooted into OS X to figure out if the device fails here as well and found a similar situation – Bluetooth went into its weekend saying

“Bluetooth: Not Available”

Eventually, that’s no driver issue, that’s definitely a hardware problem. One machine, two operating systems, different drivers (well module in OS X) resulting in a similar failure. Saturday noon and a not that satisfying Apple Store density in Germany, there is little one could do before next Monday. Hardware dies; usually at the most unpleasant moment you can imagine and nothing you can do about that.

Bluetooth: Not Available

Get a Fresh View

I did not follow the debugging rules in their given order, but I always try to keep the rule Get a Fresh View in mind. Often one is biased by some ideas in ones mind, some posts read while doing research or personal previous experience.

Eventually, I remembered what I have learned about power cycles during studies and realized that rebooting nowadays is not a hard reset of your machine anymore – there have been times (I do still remember) when PCs provided a (at least by me frequently used) reset button causing the device to hard reboot by turning the power of and on again.

So what’s the difference by rebooting the laptop several times, or booting into another OS? Right, this is no cold start and probably all devices keep their previous (faulty) state even after the reboot. As a consequence, plug out the power source, turn of the machine – leave it for a few seconds and turn it on again. Bluetooth is up and running again for both, Windows and Mac OS.

WordPress Internal Server Error 500 for Uploaded Images

After upgrading WordPress on my Windows Server 2008 to version 3.4.1, I encountered a quite strange behavior. Using the Add New Post functionality, images, uploaded by multi-file-uploader have not been displayed anymore, neither in the editor nor in the post itself.

Add New Post Editor

Once you finished your article, your blog will end up with a Internal Server Error 500. However, all thumbnails created by WordPress can be requested without any problems.

500 - Internal Server Error Message

Eventually, I started to do some research on this issue, ending in a quite exhaustive digging down to the metal of Windows, however, with a quite surprisingly outcome. In this article I’ll try to give an overview of this issue, explaining why this occurs on Windows and how to solve this with almost a  single click.

There are quite a lot of blog entries and stackoverflow answers about this topic with more or less useful steps. If you are just looking for the quick answer, without the need of understanding what causes this particular problem, here it comes:

Change the system’s default temp folder (C:\Windows\temp) rights by granting rights for IIS_IUSRS user and you are probably done.

Temp Properties

The WordPress image upload is using the standard PHP functionality, using the temporary upload folder specified in your php.ini file.  By default, PHP is using the system’s temporary directory (e.g. c:\windows\temp) for uploading the initial image.

php.ini File Uploads Settings

Eventually, using the system’s temp folder is the root cause of the issue described in this article. When uploading the image to the temp folder, the file is initially created on the system. Consequently, the file is inheriting the folder’s security settings. After uploading, the original file is copied into the destination folder, e.g. \wp-content\uploads\2012\08.  Here all thumbnails are generated from the original file. As they are being created in the destination folder, they will inherit the security settings from this folder resulting in two different sets of permissions applied to the original file and the thumbnails. This explains why you will only receive an error with error code 500 for the original file, while all the thumbnails can be requested without any problems. 

In case you have already images the destination folder causing an error code 500, you can reapply the actual rights of the wp-content folder which will probably fix the problem.

In case changing the permissions of the system’s temp folder does not fix the issue, check your php.ini file if another upload folder is specified in the file uploads section. Baer in mind that PHP will use the system’s temp file for uploads also as backup in case PHP has no access rights for the folder specified in the php.ini  file. 

If you consider granting IIS_IUSRS as a security risk to access the system’s default temp folder you might want to specify an alternate upload folder anyway.

Wo sind meine Signaturen in Outlook 2010 hin

Ein anscheinend weit verbreitetes Problem mit Outlook 2010 scheint eine Fehler mit dem Signatur-Editor Signatures & Stationary zu sein, der es eigentlich ermöglicht Signatur-Dateien für E-Mails zu erstellen und zu verwalten. Der Editor öffnet sich nicht und der Benutzer kann daher keine Signaturen anlegen oder gar auswählen. Speziell für den Geschäftsverkehr sind Signaturen jedoch unerlässlich. Dabei gibt es grundsätzlich zwei Wege an den Dialog zu gelangen.

In einer Nachricht kann über die Schaltfläche Signatures / Signatures… der Editor geöffnet werden.

Signaturen in Outlook 2010 aus Mails bearbeiten

Alternativ kann dies auch über das Backstage von Outlook unter dem Menüpunkt File / Options / Mail / Signatures … geschehen.

Signaturen in Outlook 2010 aus den Einstellungen bearbeiten

Aus unerklärlichen Gründen kann es nun passieren, dass trotz wiederholtem Betätigen der Schaltflächen nichts passiert. Es erscheint kein Dialog, keine Fehlermeldung kein Nichts. Warum? Man weiß es nicht. Muss die Signatur bei jedem Geschäftsbrief von Hand eingefügt werden, steigt der Frustfaktor recht schnell an und Outlook fällt schnell in Ungnade.

Überwiegend lässt sich dieses Phänomen auf Systemen mit einer 64-Bit-Version von Windows 7 und einer 32-Bit-Version von Office 2010 beobachten. Lösen lässt sich das Problem mit wenigen Handgriffen.

Zunächst öffnet man den Registry Editor (regedit.exe) und navigiert zu

HKEY_LOCAL_MACHINESOFTWAREClassesWow6432NodeCLSID{0006F03A-0000-0000-C000-000000000046}LocalServer32

hier ersetzt man den Wert für Schlüssel Default den Wert

C:Program Files (x86)Microsoft OfficeOffice14Outlook.exe

ein. Nun wiederholt man das gleiche für

HKEY_LOCAL_MACHINESOFTWAREClassesCLSID{0006F03A-0000-0000-C000-000000000046}LocalServer32

Nach einem Neustart von Outlook sollte dann der Dialog zum Editoren von Signaturen ohne Widersprüche starten und das Wochenende ist gerettet.

Signatures & Stationary Dialog von Outlook 2010

Huge Visual Studio Find and Replace Dialogs

Every time I reopend the Find and Replace dialog box (CTRL+H) in Microsoft Visual Studio 2010,  the width of the dialog box grew by several pixels. I was looking through various settings in Visual Studio, however, I haven’t thought of a bug in Visual Studio at all.

Finally, Alex Zeitler pointed me to a hotfix  for this issue. The Knowledge Base entry KB2268081 explains the issue in details. The issue affects the following products:

  • Microsoft Visual Studio 2010 Shell (Integrated)
  • Microsoft Visual Studio 2010 Shell (Isolated)
  • Microsoft Visual Studio 2010 Ultimate
  • Microsoft Visual Studio 2010 Professional

In case you use the Find and Replace dialog quite often, you might download and install the hotfix from the connect site.

Master Pages and XHTML

Today, we encountered a really interesting issue with Visual Studio 2010, ASP.NET and Master Pages. Actually Visual Studio denied the design view for all of the pages within the solution except to the master page.

The page has one or more <asp:Content> controls that do not correspond with <asp:ContentPlaceHolder> controls in the Master Page.

No doubt you would check all the pages as well. After verifying that all pages have been correct, the ID as well as the ConteptPlaceHolderID tags are set correctly, you might see that the issue is till persistent.

Master Page Error

In this case check your HTML source code of the Master Page. In particular check for all HTML tags with self closing syntax. Referring the W3C Recommendation for XHTML section C.3 there are some tags that should be not used with self closing syntax.

Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p> and not <p />).

Eventually, you now will review again your source code for any XHTML tags in their minimized form.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title />
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
...

In the example above change the title tag to

<title></title>

and the issue will be fixed. Even better would be of course to give your page a title.

While most browsers are quite forgiving here, the Visual Studio designer quits his job. Unfortunately, the error displayed is misleading and you might waste some time in reviewing Master Pages and ASP.NET controls that are obviously correct. Whether this is a bug or Visual Studio designer doing the right job and failing just for those tags based on the W3C Recommendation – it does of course not help a lot if Visual Studio does provide a misleading error message to the developer.

KB967723 vs Windows Server 2008

I recently experienced issue installing security update KB967723 for Windows Update on a Windows Server 2008 (32-bit). This seems to be a very common issue with Windows Server 2008 resulting in a error code 80070490.

KB967723 important update was not installed

The easiest way is getting the update from the Microsoft Download Center for 32-bit or for 64-bit directly. Once you get the update you can execute the standalone installer to install the security update manually. This should do the job.

KB967723 Standalone Installer

Once installed you can start Windows Update again, it should now show Windows being up to date. Let me know if this worked for you.

Windows up to date