]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units: starting suspend.target should not fail when suspend is successful (#6678)
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Wed, 30 Aug 2017 16:20:23 +0000 (17:20 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 30 Aug 2017 16:20:23 +0000 (18:20 +0200)
and the same for hibernate.target and hybrid-sleep.target.

Tested with both sucessful and unsuccessful suspends.  The result of the
start job was correct in both cases.  Closes #6419 (a regression in v233
and v234).

> suspend is unsual for a target, because it has to stop itself once it's
> started. Otherwise you couldn't start it again, so you could only suspend
> once! Currently that's implemented using BindsTo=systemd-sleep.service.
> Meaning it pulls in systemd-sleep.service to do the actual suspend, and
> then de-activates afterwards. But the behaviour of BindsTo was changed
> recently (not without some issues during development) - maybe this bug
> is caused by poettering/systemd@631b676 which I think was added in
> release v233.
>
> sleep.target (see man systemd.special) has the same need, but it
> implements it differently. It simply has StopWhenUnneeded=yes.

This commit switches suspend.target etc. to the approach used by
sleep.target.

units/hibernate.target
units/hybrid-sleep.target
units/suspend.target

index 143eb59230c78167bd6830dfc2927a11017671c4..0e1bc032583a71c3228a264afa4dea10e24e4539 100644 (file)
@@ -9,5 +9,6 @@
 Description=Hibernate
 Documentation=man:systemd.special(7)
 DefaultDependencies=no
-BindsTo=systemd-hibernate.service
+Requires=systemd-hibernate.service
 After=systemd-hibernate.service
+StopWhenUnneeded=yes
index d2d340922504c8253fdfae1041139a59dfac46d0..410e131b6ead844ab99c4f00082130107cbacd88 100644 (file)
@@ -9,5 +9,6 @@
 Description=Hybrid Suspend+Hibernate
 Documentation=man:systemd.special(7)
 DefaultDependencies=no
-BindsTo=systemd-hybrid-sleep.service
+Requires=systemd-hybrid-sleep.service
 After=systemd-hybrid-sleep.service
+StopWhenUnneeded=yes
index f50cb2264f5d9af3127e2ec802cb3c004658654c..80d652755c798e6de1b0230936706e96c9dc2e00 100644 (file)
@@ -9,5 +9,6 @@
 Description=Suspend
 Documentation=man:systemd.special(7)
 DefaultDependencies=no
-BindsTo=systemd-suspend.service
+Requires=systemd-suspend.service
 After=systemd-suspend.service
+StopWhenUnneeded=yes