Bug 87832

Summary: systemctl hybrid-sleep/hibernate fails
Product: systemd Reporter: Marcos Mello <marcosfrm>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTABUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Marcos Mello 2014-12-29 15:10:39 UTC
My system does not have swap. When I run systemctl hybrid-sleep it fails:

# systemctl -l status systemd-hybrid-sleep.service
● systemd-hybrid-sleep.service - Hybrid Suspend+Hibernate
   Loaded: loaded (/usr/lib/systemd/system/systemd-hybrid-sleep.service; static)
  Drop-In: /etc/systemd/system/systemd-hybrid-sleep.service.d
           └─debug.conf
   Active: failed (Result: exit-code) since Seg 2014-12-29 12:17:40 BRST; 13min ago
     Docs: man:systemd-suspend.service(8)
  Process: 653 ExecStart=/usr/lib/systemd/systemd-sleep hybrid-sleep (code=exited, status=1/FAILURE)
 Main PID: 653 (code=exited, status=1/FAILURE)

Dez 29 12:17:39 thinkpad.localdomain systemd-sleep[653]: Failed to open configuration file '/etc/systemd/sleep.conf': No such file or directory
Dez 29 12:17:39 thinkpad.localdomain systemd-sleep[654]: Spawned /usr/lib/systemd/system-sleep/hdd-apm-level.sh as 655.
Dez 29 12:17:39 thinkpad.localdomain systemd-sleep[653]: /usr/lib/systemd/system-sleep succeeded.
Dez 29 12:17:39 thinkpad.localdomain systemd-sleep[653]: Suspending system...
Dez 29 12:17:40 thinkpad.localdomain systemd[1]: systemd-hybrid-sleep.service: main process exited, code=exited, status=1/FAILURE
Dez 29 12:17:40 thinkpad.localdomain systemd[1]: Failed to start Hybrid Suspend+Hibernate.
Dez 29 12:17:40 thinkpad.localdomain systemd[1]: Unit systemd-hybrid-sleep.service entered failed state.
Dez 29 12:17:40 thinkpad.localdomain systemd[1]: systemd-hybrid-sleep.service failed.

Same thing with systemctl hibernate. I think a swap presence check is missing in there...

systemd-216-12.fc21.x86_64
Comment 1 Marcos Mello 2014-12-29 21:11:29 UTC
Man page (systemd-sleep) does not mention what should happen if requested suspend type is not available (no swap, etc). Now I am not sure if this is a bug or not. How can I query logind's CanHybridSleep/CanHibernate from the command line?
Comment 2 Zbigniew Jedrzejewski-Szmek 2014-12-30 15:14:53 UTC
It should fail, I guess. A better error message should be generated though.

> How can I query logind's CanHybridSleep/CanHibernate from the
> command line?

gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanHibernate

If I disable swap, it returns 'na' properly.
Comment 3 Marcos Mello 2014-12-30 20:07:14 UTC
Indeed, it shows 'na' for both CanHibernate and CanHybridSleep.
Comment 4 Zbigniew Jedrzejewski-Szmek 2014-12-30 23:49:18 UTC
I made a small cleanup in http://cgit.freedesktop.org/systemd/systemd/commit/?id=a39b4bdd10. systemctl hibernate/hybrid-sleep will now immediately fail with:
Failed to execute operation: Sleep verb not supported

But I think everything is working as expected, and already was, apart from a sligthly messier message, so I'll close this bug.

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.