按电源键不会触发关机。
我确实在 Journalctl 中看到“按下电源键”,但仅此而已。
$ sudo journalctl --unit systemd-logind --boot
-- Logs begin at Fri 2020-02-07 16:50:59 CET, end at Wed 2024-03-20 08:55:50 CET. --
mrt 20 08:54:05 STLinux systemd[1]: Starting Login Service...
mrt 20 08:54:07 STLinux systemd-logind[851]: Watching system buttons on /dev/input/event0 (pmic_onkey)
mrt 20 08:54:07 STLinux systemd-logind[851]: New seat seat0.
mrt 20 08:54:07 STLinux systemd[1]: Started Login Service.
mrt 20 08:54:19 STLinux systemd-logind[851]: New session c1 of user yocto.
mrt 20 08:54:50 STLinux systemd-logind[851]: Power key pressed.
mrt 20 08:54:52 STLinux systemd-logind[851]: Power key pressed.
mrt 20 08:54:53 STLinux systemd-logind[851]: Power key pressed.
mrt 20 08:54:54 STLinux systemd-logind[851]: Power key pressed.
mrt 20 08:54:54 STLinux systemd-logind[851]: Power key pressed.
mrt 20 08:54:54 STLinux systemd-logind[851]: Power key pressed.
什么可能阻止我的系统关闭?
这是我的logind.conf:
$ cat /etc/systemd/logind.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=yes
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
取消注释#HandlePowerKey=poweroff
不会改变任何事情。
systemd-inhibit 显示没有任何东西阻止关闭:
$ sudo systemd-inhibit --list
No inhibitors.
这是 Yocto OpenSTLinux 系统。