You are not logged in.
In /etc/systemd/logind.conf, I set
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
Running journalctl --unit=systemd-logind --follow (with systemd.log_level=debug set on the kernel's command line) produces some interesting output.
Jan 19 23:48:39 arch systemd-logind[395]: Lid closed.
Jan 19 23:48:39 arch systemd-logind[395]: sd-device-enumerator: Scan all dirs
Jan 19 23:48:39 arch systemd-logind[395]: sd-device-enumerator: Scanning /sys/bus
Jan 19 23:48:39 arch systemd-logind[395]: sd-device-enumerator: Scanning /sys/class
Jan 19 23:48:39 arch systemd-logind[395]: Handling of handle-lid-switch (edge) is disabled, taking no action.
Jan 19 23:48:39 arch systemd-logind[395]: sd-device-enumerator: Scan all dirs
Jan 19 23:48:39 arch systemd-logind[395]: sd-device-enumerator: Scanning /sys/bus
Jan 19 23:48:39 arch systemd-logind[395]: sd-device-enumerator: Scanning /sys/class
Jan 19 23:48:39 arch systemd-logind[395]: Handling of handle-lid-switch (level) is disabled, taking no action.
Jan 19 23:48:43 arch systemd-logind[395]: Lid opened.
what do?
Last edited by brinterer (2022-01-20 18:14:55)
Offline
Please use [ code ] rather than [ quote ] for outputs
Are you running something else that wants to handle the lid?
systend-inhibit --list
Online
Jan 19 23:48:39 arch systemd-logind[395]: Handling of handle-lid-switch (edge) is disabled, taking no action.
…
Jan 19 23:48:39 arch systemd-logind[395]: Handling of handle-lid-switch (level) is disabled, taking no action.
In addition to the "main" configuration file, drop-in configuration snippets are read from /usr/lib/systemd/*.conf.d/, /usr/local/lib/systemd/*.conf.d/, and /etc/systemd/*.conf.d/. Those drop-ins have higher precedence and override the main configuration file. Files in the *.conf.d/ configuration subdirectories are sorted by their filename in lexicographic order, regardless of in which of the subdirectories they reside. When multiple files specify the same option, for options which accept just a single value, the entry in the file sorted last takes precedence, and for options which accept a list of values, entries are collected as they occur in the sorted files.
Also, did you reboot or
systemctl restart systemd-logind
?
Offline
Please use [ code ] rather than [ quote ] for outputs
Are you running something else that wants to handle the lid?
systemd-inhibit --list
I don't think I do.
$ systemd-inhibit --list
WHO UID USER PID COMM WHAT WHY MODE
NetworkManager 0 root 395 NetworkManager sleep NetworkManager needs to turn off networks delay
1 inhibitors listed.
Jan 19 23:48:39 arch systemd-logind[395]: Handling of handle-lid-switch (edge) is disabled, taking no action.
…
Jan 19 23:48:39 arch systemd-logind[395]: Handling of handle-lid-switch (level) is disabled, taking no action.https://man.archlinux.org/man/logind.conf.5 wrote:In addition to the "main" configuration file, drop-in configuration snippets are read from /usr/lib/systemd/*.conf.d/, /usr/local/lib/systemd/*.conf.d/, and /etc/systemd/*.conf.d/. Those drop-ins have higher precedence and override the main configuration file. Files in the *.conf.d/ configuration subdirectories are sorted by their filename in lexicographic order, regardless of in which of the subdirectories they reside. When multiple files specify the same option, for options which accept just a single value, the entry in the file sorted last takes precedence, and for options which accept a list of values, entries are collected as they occur in the sorted files.
Also, did you reboot or
systemctl restart systemd-logind
?
I did indeed do those things.
Last edited by brinterer (2022-01-20 13:02:45)
Offline
Can you post your actual file? You did not forget to remove the leading # that would make it a comment and not be executed, did you?
Online
Did you also read the quoted manpage section?
systemd-analyze cat-config systemd/logind.conf
Also, more manpage
HandleLidSwitch= defaults to "suspend". HandleLidSwitchExternalPower= is completely ignored by default (for backwards compatibility) — an explicit value must be set before it will be used to determine behaviour. HandleLidSwitchDocked= defaults to "ignore". If the system is inserted in a docking station, or if more than one display is connected, the action specified by HandleLidSwitchDocked= occurs; if the system is on external power the action (if any) specified by HandleLidSwitchExternalPower= occurs; otherwise the HandleLidSwitch= action occurs.
I could imagine the setup rather meets HandleLidSwitchExternalPower ?
Offline
Did you also read the quoted manpage section?
systemd-analyze cat-config systemd/logind.conf
Also, more manpage
HandleLidSwitch= defaults to "suspend". HandleLidSwitchExternalPower= is completely ignored by default (for backwards compatibility) — an explicit value must be set before it will be used to determine behaviour. HandleLidSwitchDocked= defaults to "ignore". If the system is inserted in a docking station, or if more than one display is connected, the action specified by HandleLidSwitchDocked= occurs; if the system is on external power the action (if any) specified by HandleLidSwitchExternalPower= occurs; otherwise the HandleLidSwitch= action occurs.
I could imagine the setup rather meets HandleLidSwitchExternalPower ?
I found something interesting in /etc/systemd/logind.conf.d/do-not-suspend.conf (very aptly named file, btw)
# /etc/systemd/logind.conf.d/do-not-suspend.conf
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Login]
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
I removed those lines and added HandleLidSwitchExternalPower=suspend to logind.conf. Problem solved.
Offline
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline