Bug 540067

Summary: Hibernation to encrypted swap no longer possible in F12
Product: [Fedora] Fedora Reporter: Tore Anderson <tore>
Component: DeviceKit-powerAssignee: Richard Hughes <richard>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: abuse, rhughes, richard, sluskyb, thomas.mey, tigeli
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-22 22:06:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tore Anderson 2009-11-22 05:18:06 UTC
Description of problem:

In F11, I could hibernate my Lenovo ThinkPad X61s without any problems.  After upgrading to F12, the button is no longer present in the "turn off system" dialogue box, nor is it available as an action in gnome-power-manager.  In F11 the system would hibernate automatically when battery cacpacity was critically low, however in F12 I now just get a message that said it failed instead.


Version-Release number of selected component (if applicable):

F12, DeviceKit-power-012-2.fc12.x86_64


How reproducible:

100%


Steps to Reproduce:
1. Try to hibernate the machine through standard GUI tools
2.
3.
  
Actual results:

It won't let me.


Expected results:

It should let me.  After all, it worked in Fedora 11.

Additional info:

Smolt profile: http://www.smolts.org/show?uuid=pub_42d1d513-8f1c-4746-9d6b-7301d0ba27aa

Admittedly I'm making a guess when assigning this report to the DeviceKit-power package.  I'm not too familiar with which "under the hood" service does what task in a modern distro anymore, unfortunately.  I apologise in advance if this DeviceKit-power is the wrong package, and ask you to reassign the bug to the correct one.

Comment 1 Pasi Sjöholm 2009-11-25 22:00:12 UTC
It's a bug in DeviceKit-power, see: https://bugs.freedesktop.org/show_bug.cgi?id=23196 .

Comment 2 Tore Anderson 2009-11-25 22:12:17 UTC
Nice catch.  I am indeed using encrypted swap.

Tore

Comment 3 Bas Mevissen 2009-11-30 16:40:07 UTC
Same here, encrypted swap worked fine with FC11. After upgrade to FC12, the option was no longer available in the Gnome menus.

Note that pm-hibernate still works fine with FC12 on my Dell Precision M6300.

pm-is-supported --hibernate && echo OK
OK

devkit-power -d
(...)
Daemon:
(...)
  can-hibernate     no
(...)

Comment 4 Tore Anderson 2010-04-12 17:54:27 UTC
Is nothing being done to fix this very annoying bug?  Both hibernation and disk encryption are pretty crucial features to many laptop users...

Tore

Comment 5 Bas Mevissen 2010-04-12 23:51:12 UTC
Yes, it is very annoying. I hacked the source of the devkit-power-daemon to allow hibernate on encrypted swap. Hibernation is fine with that hack.

In source file dkp-daemon.c, look for the following piece of code:

        /* encrypted swap? */
        if (daemon->priv->hibernate_has_encrypted_swap) {
                error = g_error_new (DKP_DAEMON_ERROR,
                                     DKP_DAEMON_ERROR_GENERAL,
                                     "Swap space is encrypted");
                g_error_free (error_local);
                dbus_g_method_return_error (context, error);
                goto out;
        }

Put #if 0 and #endif around it and you are fine. The devkit-power-daemon lives in /usr/libexec. Replace it and restart the daemon (a reboot is the easy way).

Comment 6 Tore Anderson 2010-04-13 05:41:53 UTC
Bas, thanks!

To me your change does not seem as a hack at all, it seems to me the whole purpose of that code is to prevent hibernation to encrypted swap.  However, hibernation to encrypted swap works just as well as hibernation to unencrypted swap.  The check is obviously broken and should be removed - your change appears to me as the correct fix.  It should really be added to F12/13.

By the way, I think the reason for the check must be to prevent hibernation to encrypted swap if the user has no means to unlock the swap and thus resume from it.  If this is the case or not depends on unlocking support in initramfs, and Fedora has had that since at least since F11 (probably longer), and it has been working well.  There is therefore no reason to have this check in the Fedora packages, but plenty of reason to take it out.

Tore

Comment 7 Thomas Meyer 2010-04-27 21:30:25 UTC
Yup, still broken in Fedora 12.

Commit that introducted that behaviour:
http://cgit.freedesktop.org/DeviceKit/DeviceKit-power/commit/?id=ea6ebd1a526653bb9d59d5143d844c0f7557a351

Above commit tries to fix the freedesktop bugilla bug 23196:

http://bugs.freedesktop.org/show_bug.cgi?id=23196

Many thanks to Dustin Kirkland and the eCryptfs guys, that broke hibernate function in Fedora 12 to an encrypted swap, that is pretty good supported in Fedora 12!

Comment 8 Richard Hughes 2010-04-28 08:15:23 UTC
I'm guessing this commit fixes things for you: http://cgit.freedesktop.org/upower/commit/?id=5f1e64709b62517e4a925e952d255ab16d818df0

Comment 9 Thomas Meyer 2010-04-28 17:32:15 UTC
It there a rpm available to test, e.g. in koji (or what is it called) or so?

Comment 10 Thomas Meyer 2010-05-05 18:26:34 UTC
Will there be an update for Fedora 12 for this package?

Comment 11 Richard Hughes 2010-05-05 18:56:59 UTC
Yup, I'll hopefully do it this week at some point. If you need a fix now, rebuild the srpm package from here: http://people.freedesktop.org/~hughsient/fedora/13/SRPMS/

Comment 12 Thomas Meyer 2010-05-14 09:47:17 UTC
I replaced DeviceKit-power-014-1.fc12.x86_64 by upower-0.9.4-1.fc13.x86_64 and the "Hibernate" button appears and works now. Thanks for the fix.

Comment 13 Ben Slusky 2010-05-20 00:45:09 UTC
*** Bug 575898 has been marked as a duplicate of this bug. ***

Comment 14 Ben Slusky 2010-05-20 00:45:49 UTC
Works for me too. Thanks!

Comment 15 Thomas Meyer 2010-06-22 14:59:52 UTC
Fixed in current Fedora 13. Thanks!