我的笔记本电脑有时会在合上盖子时暂停,有时则不会。这是journalctl的一些输出,它显示挂起触发可能有五分之一或六分之一
-- 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.
我希望在盖子关闭时能够可靠地触发暂停,但我不知道为什么不这样做。我可以做什么来调查原因?
到目前为止,我已经尝试查看日志输出(大致是上面的内容 - 它确认存在问题,但不多),以及查看udevadm monitor
盖子关闭/打开期间的输出,但是那里的输出有噪音,而且也没有很有帮助。
答案1
如果您在启动机器后三分钟内合上盖子,某些版本的 systemd 会拒绝挂起,并且在恢复后可能还会出现更短的超时。这些数量是不可配置的。这可能是你的问题吗?
对于调试工具,请参阅这篇文章,了解增加日志级别以使登录实际上告诉您为什么它没有挂起(不是超级直观):
http://lists.freedesktop.org/archives/systemd-devel/2013-March/010004.html
更新
根据 @ajp 的评论,假设您的 systemd 是最新的,您想要的解决方案似乎是将添加HoldoffTimeoutSec=0s
到/etc/systemd/logind.conf
.事实上,现在似乎已记录在systemd.conf
.我很高兴从回答这个问题中学到了一些东西。