Non cleared inhibition of handle-lid-switch by gsd-power prevents suspend on lid close when not docked
Occasionally, after undocking from a USB-C dock on my Lenovo X1C gen 7 laptop, it will stop suspending when closing the lid. Worse, it will not even lock the screen anymore. Manually triggering suspend (key combination) does still work at this point.
Tracing the issue. Lid events are detected
$ journalctl -u systemd-logind
mrt 03 17:41:56 thinkpad-pvs systemd-logind[1344]: Lid opened.
mrt 03 17:42:05 thinkpad-pvs systemd-logind[1344]: Lid closed.
Checking the inhibit list I see the following.
$ systemd-inhibit --list --mode=block
WHO UID USER PID COMM WHAT WHY MODE
gdm 121 gdm 2101 gsd-power handle-lid-switch External monitor attached or configuration changed recently block
gdm 121 gdm 2932 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
user 1000 user 3537 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
The block from gsd-power
seems incorrect. At this point I haven't been connected to a external monitor for an hour, and only used my laptop standalone.
For comparison when I am connected to a dock with external monitor. I get
WHO UID USER PID COMM WHAT WHY MODE
gdm 120 gdm 2749 gsd-power handle-lid-switch External monitor attached or configuration changed recently block
gdm 120 gdm 2746 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
user 1000 user 3770 gsd-power handle-lid-switch External monitor attached or configuration changed recently block
user 1000 user 3778 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
So to me it seems like the block from the first gsd-power
running as user gdm
is not cleared after removing the laptop from the dock. This is also somewhat confirmed by killing this gsd-power
process and having the suspend functionality work again on lid-close. Are there supposed to be two gsd-power
processes performing the block?
This seems to be a corner case and it also doesn't happen always. I did see a handful of other reports that are very close this one. The fact those exists are confirming my suspicion this not only an issue with my setup. Two of the three reports also mention a Lenovo ThinkPad, and a USB-c dock. Could that be a smoking gun?
-
This AskUbuntu question. Here the exact same issue is reported. It also shows a workaround that keeps the
gsd-power
process killed. -
This second AskUbuntu question. Looks eerie similar. Unfortunately, the full output from
systemd-inhibit
is missing here. -
This gdm issue. Very similar. Closed by the original author with no further action.