Tuesday, April 9, 2013

How to debug an unexpected UAC prompt

Recently a self created executable showed the UAC prompt and it wasn't clear why. It sure didn't need administrative privileges. So how to debug this?

Wikipedia tells the UAC prompt can be triggered by:

  • the "Run the program as an administrator" compatibility option. Just check the file properties
  • the executable's manifest: if requestedExecutionLevel is present and is not asInvoker, the UAC prompt is triggered. An external manifest can be just opened with a text viewer. Also check for an embedded manifest: open the executable file in Visual Studio and check the RT_MANIFEST resource. If Visual Studio displays an error message that there are no resources, you are fine. Without resources there is no embedded manifest
  • the UAC heuristic: it checks the file name, the string resources, the manifest for keywords that indicate an installer

In my case it was the UAC heuristic. To be specific, the UAC prompt was triggered by the long and cryptic (and automatically generated) file name. Some sequence in it told UAC that this must be an installer. So renaming the file fixed the problem - no UAC prompt any more.

Friday, April 5, 2013

Why backups if you have a NAS?

I recently bought a Synology DS212j and set up a SHR (RAID1 with extra features). Then - after some toyingthorough feature evaluation - I configured backup tasks using the Time Backup extension.

Why, you might ask, do you really think two hard disks are going to crash at the same moment?

No, I don't. But mirroring doesn't protect us against files being corrupted by faulty applications. Or accidentally deleted. Thanks to Jeff Mitchell for the reminder.

BTW: What IS the probability of two hard disks in a RAID array failing? Two hard disks from the same lot? With the exact same load through all their lifetime? Within the time frame that it takes to rebuild the RAID?

Synology: Time Backup on DiskStation has failed. Please check the package log for further information.

Today my new Synology DS212j notified me via email about: Time Backup on DiskStation has failed. Please check the package log for further information.

Aside from the email notification and missing versions in the timeline, I could not find any indication of the error nor its reason in the general web interface nor the Time Backup web interface.

Google told me that the Time Backup package log could be found at /var/log/timebkp.log.

So I logged in via ssh and found: {WARN}{1365130850}{...}{Task [matthias] has failed to backup shared folder [matthias] due to [error occurred while copying files].} {ERR}{1365130850}{matthias}{Task [matthias] has failed to backup version [20130405-0500] due to [error occurred while copying files].}

Not very informative. However, in the sibling /var/log/timebkp.debug I found: Apr 05 00:00:54 [14260]BK_ERR:rsync return with error, return code = 41

Which led me to notify the file /var/log/rsync.error which hold the solution: Apr 05 00:00:53 (14436) [ERROR] log.c (350): rsync: recv_generator: mkdir "/volumeUSB1/usbshare/TimeBackup/..." failed: No space left on device (28)

I was first confused because the device had plenty of space left, but then realized that the ext4 file system had run out of inodes. I had originally provisioned the file system for another purpose and therefore reduced the inode count by factor 256. This and the habit of Time Backup to use lots of hard links which consume an inode per hard link had created the inode shortage.

As ext4 doesn't allow to increase the inode count I had to re-create the file system.

I plugged the hard disk back into the Synology and issued "Back Up Now" for all backup tasks. I had expected the version count to be reset to 1, but instead it retained the version count. Uneasy with this obvious difference between Time Backup and the content of the hard disk I resorted to deleting and re-creating all backup tasks. This seems to have done it.

Update 2013-12-13: The file system has run out of inodes again. Seems like you should use an above standard ratio of inodes to size for Time Backup.