You are not logged in.

#1 2022-01-20 04:51:39

brinterer
Member
Registered: 2022-01-20
Posts: 3

[SOLVED] Nothing happens when I close the lid.

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

#2 2022-01-20 08:06:44

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,409

Re: [SOLVED] Nothing happens when I close the lid.

Please use [ code ] rather than [ quote ] for outputs

Are you running something else that wants to handle the lid?

systend-inhibit --list

Online

#3 2022-01-20 08:13:12

seth
Member
Registered: 2012-09-03
Posts: 49,947

Re: [SOLVED] Nothing happens when I close the lid.

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

?

Offline

#4 2022-01-20 13:00:44

brinterer
Member
Registered: 2022-01-20
Posts: 3

Re: [SOLVED] Nothing happens when I close the lid.

V1del wrote:

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.
seth wrote:

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

#5 2022-01-20 13:17:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,409

Re: [SOLVED] Nothing happens when I close the lid.

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

#6 2022-01-20 13:20:35

seth
Member
Registered: 2012-09-03
Posts: 49,947

Re: [SOLVED] Nothing happens when I close the lid.

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

#7 2022-01-20 13:48:57

brinterer
Member
Registered: 2022-01-20
Posts: 3

Re: [SOLVED] Nothing happens when I close the lid.

seth wrote:

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

#8 2022-01-20 13:50:01

seth
Member
Registered: 2012-09-03
Posts: 49,947

Re: [SOLVED] Nothing happens when I close the lid.

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

Board footer

Powered by FluxBB