As of kernel 3.6, hybrid-sleep is now fully working. So i was wondering: does systemd support hybrid-sleep? I use only it to suspend/hibernate (i remove upower and pm-utils, relying only on systemctl suspend/hibernate).
Ps: I don't know if this is the right place, actually linux 3.6 is in testing, but the question is not regarding it.
I have the following setup:
I've made a couple of scripts in /usr/local/lib:
#!/bin/sh echo -n suspend > /sys/power/disk
#!/bin/sh echo -n "platform" > /sys/power/disk
Copy /usr/lib/systemd/system/systemd-suspend.service and /usr/lib/systemd/system/systemd-hibernate.service to /etc/systemd/system
Modify both files:
/etc/systemd/system/systemd-suspend.service: Add ExecStartPre=/usr/local/lib/sys-power-disk-suspend and change suspend by hibernate.
[Unit] Description=Suspend Documentation=man:systemd-suspend.service(8) DefaultDependencies=no Requires=sleep.target After=sleep.target [Service] Type=oneshot ExecStartPre=/usr/local/lib/sys-power-disk-suspend ExecStart=/usr/lib/systemd/systemd-sleep hibernate
/etc/systemd/system/systemd-hibernate.service: Add ExecStartPre=/usr/local/lib/sys-power-disk-platform
[Unit] Description=Hibernate Documentation=man:systemd-suspend.service(8) DefaultDependencies=no Requires=sleep.target After=sleep.target [Service] Type=oneshot ExecStartPre=/usr/local/lib/sys-power-disk-platform ExecStart=/usr/lib/systemd/systemd-sleep hibernate
and type as root
systemctl --system daemon-reload
Now I can type systemctl suspend for hybrid-suspend and systemctl hibernate for hibernation and shutdown
The good part is that this setup works on gnome 3.4 too, AFAIK it uses upower for hibernation/suspend and upower now uses systemd when available.
It seems that systemd uses only /sys/power/state for suspend/hibernate and
the hybrid-suspend needs to write "suspend" to /sys/power/disk before. The scripts do just that, and the systemd-suspend.service change to "hibernate" produces an hybrid-suspend instead of a "simple" suspend.
Hope it helps
Last edited by tonitc (2012-10-16 21:08:06)
A TODO task for systemd was added today called: "introduce hybrid-sleep.target" so I guess it will be soon adressed in the upstream too.
HP Elitebook 8560w | Arch Linux | KDE
Yes, i asked Lennart about that and he told me hybrid-sleep will soon be here!
So, only wait!
Systemd 196 now supports hybrid sleep, although I didn't find anything about how to use it with pm-utils and gnome 3.6. Anyone tried that?