A wee klanger in /usr/lib64/pm-utils/pm-functions cause pm-utils to ignore the exit codes of all hook functions. This means that suspend, hibernate etc. always proceed ("succeed"), event when a hook has indicated that the process should abort. Reproducible: Always Steps to Reproduce: # cd /etc/pm/sleep.d # cat > 00forcefail $!/bin/bash echo === $0: FAILING ==== exit 1 ^D # chmod u+x 00forcefail # rm /var/log/pm-suspend.log rm: remove regular file `/var/log/pm-suspend.log'? y # pm-suspend Actual Results: ... suspend proceeds .... (now wake the system) # cat /var/log/pm-suspend.log Initial commandline parameters: Blacklisting 01grub. Sun Mar 27 10:23:57 EST 2011: Running hooks for suspend. Running hook /etc/pm/sleep.d/00forcefail suspend suspend: === /etc/pm/sleep.d/00forcefail: FAILING ==== /etc/pm/sleep.d/00forcefail suspend suspend: success. ^^^^^^^^ ... log continues Expected Results: The suspend should not proceed, /var/log/pm-suspend.log should indicate it was aborted. According to the documentation (see /usr/share/doc/pm-utils-1.4.1-r1/HOWTO.hooks.bz2) the failure of any hook function in /etc/pm/sleep.d should prevent the system suspending or hibernating. I have a pm-utils hook which prevents the system hibernating with any ntfs-3g partitions mounted. I dual boot this system with Windows 7 and share an NTFS partition - for me this is supposed to prevent data loss in the case where I hibernate linux and later accidentally reboot into windows. Patch attached (you'll chuckle).
Created attachment 267333 [details, diff] Patch
That's important! Please apply the patch freedesktop.
someone reported it upstream yet ?
Appearently not. The bug is still present in their git master at git://anongit.freedesktop.org/git/pm-utils
Hmmm... on second thoughts, preventing a suspend or hibernate from succeeding is a pretty nasty thing to do. At least without checking on the power situation... some time after I fixed this bug, my laptop battery ran down, my hook prevented hibernation, and so the machine simply ran out of power. So much for my data-loss-preventing hook. Perhaps this is why the bug hasn't been noticed/fixed earlier; the hook fail capability is in itself a bit questionable and rarely used. In my case (prevent hibernating with mounted ntfs-3g partition), forcibly unmounting in the hook is a better idea than allowing a power fail to occur. It seems to me pm-utils would be better off if it supported a "forced" hibernation/suspend (seeing as the client of pm_utils presumably knows whether the hibernation is due to a critical power situation). Also, if a hook can fail, a means of passing the reason it failed back up to the client is a good idea. In any case a note about the potential power loss situation in the HOWTO.hooks document wouldn't go astray.
Looks like this is, http://bugs.freedesktop.org/show_bug.cgi?id=32210 And it's applied in Debian as 26-inhibit-on-right-status.patch inside http://ftp.de.debian.org/debian/pool/main/p/pm-utils/pm-utils_1.4.1-14.debian.tar.xz
Fix applied as pm-utils-1.4.1-r3