You are not logged in.

#1 2012-10-07 17:25:01

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 816

systemd and kernel 3.6 's hybrid-sleep

Hi!
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).
Thanks guys!
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.

Offline

#2 2012-10-16 20:53:04

tonitc
Member
Registered: 2012-10-16
Posts: 1

Re: systemd and kernel 3.6 's hybrid-sleep

I have the following setup:

I've made a couple of scripts in /usr/local/lib:

/usr/local/lib/sys-power-disk-suspend

#!/bin/sh
echo -n suspend > /sys/power/disk

/usr/local/lib/sys-power-disk-platform

#!/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)

Offline

#3 2012-10-16 21:01:42

Teho
Member
Registered: 2010-01-30
Posts: 200

Re: systemd and kernel 3.6 's hybrid-sleep

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

Offline

#4 2012-10-17 05:21:06

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 816

Re: systemd and kernel 3.6 's hybrid-sleep

Yes, i asked Lennart about that and he told me hybrid-sleep will soon be here!
So, only wait!

Offline

#5 2012-11-29 15:17:57

Fedes
Member
From: Buenos Aires, Argentina
Registered: 2012-10-23
Posts: 36

Re: systemd and kernel 3.6 's hybrid-sleep

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?

Offline

Board footer

Powered by FluxBB