Bug Description

I have determined that powernap is causing my system to be unable to unmount root (/) on shutdown or reboot. I noticed that my system was doing an fsck check of root on every boot following installation of powernap. I found that the system was failing to unmount '/' due to it being busy. I instrumented the /etc/init.d/umountroot script by adding 'fuser -vm / > /etc/init.d/umountroot.err 2>&1; sync' after the failing mount command that attempts to unmount '/'. This gave me a list of processes that had open file descriptors. I found the following line in that list

root 1414 Frce. powernapd

So it seems that powernapd has an open file handle that is causing root to be busy and so it won't unmount.

I then proceeded to patch the /etc/init/powernap.conf upstart file to add a stop directive so powernapd will get unloaded on shutdown

Please note that I built this package from source using dpkg-buildpackage so I could get a later version to go with Natty.

Attached please find my /etc/powernap/config file. Note that I do not have debugging enabled (DEBUG=0), but I noticed that log and err files are still being generated (albeit very small files with nothing in them)

1. Install powernap and configure (in my case see above config file)
2. Enable powernap debugging by setting
DEBUG=1
in /etc/powernap/config
3. Reboot system (using 'shutdown -r now')
4. Disable powernap debugging by setting
DEBUG=0
in /etc/powernap/config
5. Reboot system (using 'shutdown -r now')
6. On reboot you should see a warning indicating that the root drive was unmounted uncleanly and see a fsck performed on it

Notes:

I am not sure steps 2-4 are absolutely necessary, but that was part of my process to produce the bug as I was trying to debug powernap power down behavior. I mention it, since I noticed that the debug logs are always present after they have been enabled once, even if you set DEBUG=0 again, and they may need to be present for the bug to manifest (even though they are not currently being used).

As for my system configuration, I do have a USB mouse, and a PS2 keyboard. Also, I have seen this manifest with the root device as a normal hard disk, but I want to note that my nominal system configuration is that I am booting from a USB device that contains the same root filesystem as the hard disk had (the hard disk is disabled in this scenario).

Finally, I want to point out that as I stated in the original bug report, the daemon upstart script does not contain a line

stop on runlevel [!2345]

This means that the daemon does not get called to stop during shutdown (e.g transition to runlevel 6), and this is almost certainly the cause of the open file handle.

Adding that line to the upstart script eliminates my problem, and makes the script consistent with other daemons such as ssh (ssh.conf)