4

My laptop sometimes suspends when the lid is closed, and sometimes doesn't. Here's some output from journalctl, which shows the suspend triggering maybe one in five or six times

-- Logs begin at Sat 2015-02-14 17:45:21 PST, end at Tue 2015-08-18 10:53:09 PDT. --
Aug 18 08:51:05 gurney systemd[1]: Starting Login Service...
Aug 18 08:51:06 gurney systemd-logind[658]: New seat seat0.
Aug 18 08:51:06 gurney systemd[1]: Started Login Service.
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event5 (Power Button)
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event7 (Video Bus)
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event3 (Lid Switch)
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event4 (Sleep Button)
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event6 (ThinkPad Extra Buttons)
Aug 18 08:51:12 gurney systemd-logind[658]: New session 1 of user anders.
Aug 18 08:51:34 gurney systemd-logind[658]: Lid closed.
Aug 18 08:51:37 gurney systemd-logind[658]: Lid opened.
Aug 18 08:51:44 gurney systemd-logind[658]: Lid closed.
Aug 18 08:51:48 gurney systemd-logind[658]: Lid opened.
Aug 18 08:51:50 gurney systemd-logind[658]: Lid closed.
Aug 18 08:51:53 gurney systemd-logind[658]: Lid opened.
Aug 18 08:51:57 gurney systemd-logind[658]: Lid closed.
Aug 18 08:51:59 gurney systemd-logind[658]: Lid opened.
Aug 18 09:27:32 gurney systemd-logind[658]: Lid closed.
Aug 18 09:27:32 gurney systemd-logind[658]: Suspending...
Aug 18 09:27:41 gurney systemd-logind[658]: Lid opened.
Aug 18 09:27:41 gurney systemd-logind[658]: Operation finished.
Aug 18 09:27:44 gurney systemd-logind[658]: Lid closed.
Aug 18 09:27:47 gurney systemd-logind[658]: Lid opened.
Aug 18 09:27:54 gurney systemd-logind[658]: Lid closed.
Aug 18 09:28:01 gurney systemd-logind[658]: Lid opened.
Aug 18 09:43:56 gurney systemd-logind[658]: Lid closed.
Aug 18 09:43:56 gurney systemd-logind[658]: Suspending...
Aug 18 09:44:02 gurney systemd-logind[658]: Lid opened.
Aug 18 09:44:02 gurney systemd-logind[658]: Operation finished.
Aug 18 09:44:05 gurney systemd-logind[658]: Lid closed.
Aug 18 09:44:12 gurney systemd-logind[658]: Lid opened.

I want suspend to reliably trigger when the lid is closed, and I don't know why it doesn't. What can I do to investigate the cause?

So far I've tried looking at the journal output (roughly what's above - it confirms there's a problem but not much more), as well as looking at the output of udevadm monitor during lid closing/opening, but the output there is noisy and also not that helpful.

3

Some versions of systemd refuse to suspend if you close the lid within three minutes of booting your machine, and possibly another lesser timeout after resuming. These quantities are not configurable. Could that be your problem?

For tools to debug, see this post for increasing the log level to make logind actually tell you why it isn't suspending (not super intuitive):

http://lists.freedesktop.org/archives/systemd-devel/2013-March/010004.html

update

Based on @ajp's comment, it seems the solution you want, assuming your systemd is up to date, is to add HoldoffTimeoutSec=0s to /etc/systemd/logind.conf. Indeed that now seems to be documented in the man page for systemd.conf. I'm glad I learned something from answering this question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.