Systemd-logind strange behavior on lid switch

Hi,

I’ve a trouble with the lid sensors of my laptop a Lenovo B590. Sometimes the lid sensors report lid switching even if I don’t touch the lid. I’ve configured systemd-logind to ignore lid switching, but it don’t works. Every time that a lid switching is reported my session is blocked by the screensaver, that is the action that I’ve configured in the power manager settings in Xfce. What I want is that systemd truly ignores the lid switching.

My /etc/systemd/logind.conf


[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
LidSwitchIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=4096

Log messages:


Jul 11 00:24:59 lx01.local systemd-logind[4809]: Lid closed.
Jul 11 00:24:59 lx01.local systemd-logind[4809]: Lid opened.

Hi
Dumb question… you don’t where a bracelet that has a magnet…? My wife has one, couldn’t figure out why her screen was turning off (lid switch), was the magnet in her bracelet…

Else to override, I’ve only configured HandleLidSwitch=ignore not the other options.

I wouldn’t know for sure that systemd functionality is called for power functions like when the lid is closed.

You should first investigate how power is managed through your Desktop (which you didn’t identify).
Desktops have typically been around longer than systemd, and AFAIK SysVinit didn’t provide this functionality (likely some other subsystem), so Desktops likely have their own code to do power management. <Maybe> they’re integrating with systemd which would likely be a good move for various reasons in the long run, but if they do so they’d also be breaking their functionality on distros that aren’t running systemd.

TSU

Hi
Look at the man page for logind.conf, in gnome-shell there is an option in the tweak-tool, but I’ve always used logind.conf without any DE interaction across multiple laptops with both openSUSE and SLE since logind came around…?

I don’t think than the problem is related to the Desktop power management system. I’ve this problem for some months ago and in this time I’ve worked with Gnome and Xfce and now I’m working with LXQT. With the three desktops I’m having the same problem with Systemd. I’ve also tried different settings in logind.conf but without success.

At first time the log looks like that:


Jun 27 19:35:45 lx01.local kernel: thinkpad_acpi: unknown possible thermal alarm or keyboard event received
Jun 27 19:35:45 lx01.local kernel: thinkpad_acpi: unhandled HKEY event 0x60a0
Jun 27 19:35:45 lx01.local kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net
Jun 27 19:35:45 lx01.local systemd-logind[1342]: Lid closed.
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Unknown key pressed (translated set 2, code 0xf1 on isa0060/serio0).
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Use 'setkeycodes e071 <keycode>' to make it known.
Jun 27 19:35:45 lx01.local kernel: pci_bus 0000:01: Allocating resources
Jun 27 19:35:45 lx01.local kernel: pci_bus 0000:02: Allocating resources
Jun 27 19:35:45 lx01.local kernel: pci_bus 0000:03: Allocating resources
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Unknown key released (translated set 2, code 0xf1 on isa0060/serio0).
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Use 'setkeycodes e071 <keycode>' to make it known.
Jun 27 19:35:45 lx01.local kernel: thinkpad_acpi: unknown possible thermal alarm or keyboard event received
Jun 27 19:35:45 lx01.local kernel: thinkpad_acpi: unhandled HKEY event 0x60a0
Jun 27 19:35:45 lx01.local kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net
Jun 27 19:35:45 lx01.local systemd-logind[1342]: Lid opened.
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Unknown key pressed (translated set 2, code 0xf1 on isa0060/serio0).
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Use 'setkeycodes e071 <keycode>' to make it known.
Jun 27 19:35:45 lx01.local kernel: pci_bus 0000:01: Allocating resources
Jun 27 19:35:45 lx01.local kernel: pci_bus 0000:02: Allocating resources
Jun 27 19:35:45 lx01.local kernel: pci_bus 0000:03: Allocating resources
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Unknown key released (translated set 2, code 0xf1 on isa0060/serio0).
Jun 27 19:35:45 lx01.local kernel: atkbd serio0: Use 'setkeycodes e071 <keycode>' to make it known.

That’s wasn’t very clear because I couldn’t know what was the root of the problem. I managed to get rid of some of these warnings. I got rid of the atkbd warning by putting “setkeycodes e071 1” in /etc/init.d/after.local. I got rid of the thinkpad_acpi warning by compiling my own kernel without the thinkpad_acpi module.

Actually the log looks like that:


Jul 11 00:24:59 lx01.local systemd-logind[4809]: Lid closed.
Jul 11 00:24:59 lx01.local systemd-logind[4809]: Lid opened.

The only thing that I want is that Systemd ignores the lid events, but unfortunately for me, it appears that systemd is ignoring their own configuration.

These’re my actual logind.conf settings:


[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=4096

LXQT has a option in their power management module to ignore the lid events. I tried it but it’s even worse than the screen lock because when systemd reports a lid switch event LXQT closes the session.

Hi
I see those log events, not sure you can suppress. But for me it works as expected as in doesn’t hibernate or suspend when the lid is closed.


Jul 15 18:24:41 grover2.homelinux.org systemd-logind[946]: Lid closed.
Jul 15 18:24:45 grover2.homelinux.org systemd-logind[946]: Lid opened.

cat /etc/os-release
NAME=openSUSE
VERSION="Tumbleweed"
VERSION_ID="20160714"
PRETTY_NAME="openSUSE Tumbleweed (20160714) (x86_64)"