Bug 70267 - systemd 208-1 handle lid switch hibernate
Summary: systemd 208-1 handle lid switch hibernate
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-08 00:46 UTC by olassun2
Modified: 2013-11-21 02:09 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description olassun2 2013-10-08 00:46:49 UTC
Arch Linux, just upgraded to systemd 208-1 recently and now the handle lid switch no longer accepts hibernate as an option. closing the lid gives the error message:

Requested operation not supported, ignoring
Comment 1 olassun2 2013-10-08 00:49:27 UTC
changing the option to 

HandleLidSwitch=suspend

works fine, it's just hibernate that isn't.
Comment 2 olassun2 2013-10-29 05:20:49 UTC
Just an update, what broke what not only hibernate for the lid switch, but for anything in logind.conf. journactl just responds with a "requested operation not supported, ignoring"
Comment 3 olassun2 2013-10-29 05:31:37 UTC
The last working version was 207-5.
208-2 still does not work.
Comment 4 Alexey 2013-11-21 00:05:56 UTC
Hi All,

I managed to fix the bug (or maybe feature on purpose which i do not understand).
The root cause when systemd-logind checks the swap for type and see not 'partition' (file src/shared/sleep-config.c) the upper level function can_sleep (for hibernate) returns false which makes such log lines:
   "Requested operation not supported, ignoring."

My laptop setup made that i have whole sda2 under LUKS and under LUKS is only one partition (i called it /dev/mapper/root). On the given filesystem (ext4) i created /swapfile with size 8.1G. The swap works just fine. And hibernate on this swapfile works briliant out of the vanilla kernel (no uswsusp, no tuxonice).
I added to my kernel cmd line: resume=/dev/mapper/root resume_offset=34816 (See Documentation/power/swsusp-and-swap-files.txt for more)

Looking into systemd-logind code i found it checks for the swap type (from /proc/swaps) which in my case says:

$ cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/swapfile                               file            8388604 0       -1

A very small patch fixes this:
patch - 0002-fix-operation-not-supported-to-hibernate-to-swap-file.patch 
--- ./src/shared/sleep-config.c.orig    2013-09-18 01:55:37.241977274 +0400
+++ ./src/shared/sleep-config.c 2013-11-21 02:27:57.608209252 +0400
@@ -206,7 +206,7 @@
                 if (!d)
                         return -ENOMEM;
 
-                if (!streq(type, "partition")) {
+                if (!streq(type, "partition") && !streq(type, "file")) {
                         log_debug("Partition %s has type %s, ignoring.", d, type);
                         continue;
                 }


I have also submitted Arch linux user package "systemd-ak" with my fix to AUR which is available here - https://aur.archlinux.org/packages/systemd-ak/

Please try it. Please let me know any issues.

--
 Alexey
Comment 5 Zbigniew Jedrzejewski-Szmek 2013-11-21 00:44:34 UTC
An identical patch was applied recently: http://cgit.freedesktop.org/systemd/systemd/commit/?id=0c6f1f4ea4980ff719979d36f10bd6ea3e464c02. Systemd is a fast-moving target :)
Comment 6 Alexey 2013-11-21 00:49:28 UTC
good to know. better to have native packages rather then hack and compile them for your laptop, box, etc...
Comment 7 Zbigniew Jedrzejewski-Szmek 2013-11-21 00:55:05 UTC
(In reply to comment #6)
> good to know. better to have native packages rather then hack and compile
> them for your laptop, box, etc...

This is an *upstream* bug tracker. We don't do packages.
Comment 8 Alexey 2013-11-21 02:09:29 UTC
Sure. I do some times for myself..


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.