logind.conf not working, closing lid will not suspend laptop
I am running Fedora 22 on a Dell Latitude E6230. At some point I got a software patch that broke the laptop suspending when I close the lid. It was working, and now it is not. I am not sure what patch caused this, or why. I am also a newbie to Linux (but not computers), so sorry if I did not investigate something I should have.
What I have looked into:
-
I tried un-commenting these lines in
/etc/systemd/logind.conf
and then rebooting:HandleLidSwitch=suspend LidSwitchIgnoreInhibited=yes HandleLidSwitchDocked=ignore
-
sudo journalctl -b -u systemd-logind
shows that the lid is detecting that it is closing and opening.
I tried installing
gnome-power-manager
... but this seemed to have no effect.I installed gnome tweak tool and set "don't suspend on lid close" to "off". In playing with this, I also changed "power button action" to "hibernate", yet the power button just turns the laptop off, and closing the lid still does not suspend it.
-
I then went back to
/etc/systemd/logind.conf
and un-commented the lines:HandlePowerKey=suspend HandleSuspendKey=poweroff
Yes, that is backward... but this setting did not take hold. I.e., even after a reboot, the power button still turns the laptop off, and the suspend button will suspend the laptop.
This seems to prove to me that the
/etc/systemd/logind.conf
file and the gnome tweak tool setting do not have any effect. -
I tried this command... but I am not 100% what it does:
gsettings set org.gnome.settings-daemon.plugins.xrandr default-monitors-setup do-nothing
I found this on one of the threads. I did notice at this point that closing the lid while on the dock will suspend the laptop. So I thought that maybe there was some double negative action going on. I changed these lines just to test:
HandleLidSwitch=ignore HandleLidSwitchDocked=suspend
And the result is that the laptop no longer suspends while on the dock when the lid is closed, nor when the laptop is off the dock.
At no time are any external monitors hooked up.
So what the heck am I missing? What can override these settings?
I have solved the problem by removing ignore-lid-switch-tweak program from startup programs.
From terminal run: gnome-session-properties
then remove ignore-lid-switch-tweak.
I arrived here because I had the opposite problem (lid closing was not being ignored, which is what I needed).
I had solved this issue once before, but it seems the latest versions of Fedora (I'm on Fedora 28 now), requires these two entries now, whereas before only the first one was necessary:
user$ sudo vi /etc/systemd/logind.conf
HandleLidSwitch=ignore <---- Set both of these
HandleLidSwitchDocked=ignore <---- to ignore lid events.
user$ sudo systemctl restart systemd-logind
I hope that helps someone else. Please don't downvote because I added a solution for the opposite problem. :)
In my case (xubuntu 20.04), I had logind.conf allright like so:
$> sudo cat /etc/systemd/logind.conf |grep Lid
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=suspend
LidSwitchIgnoreInhibited=yes
BUT what was "inhibiting logind from doing its job I had to figure with this command:
$> systemd-inhibit --list --mode=block
WHO UID USER PID COMM WHAT WHY >
xfce4-power-manager 1000 riccardo 1838 xfce4-power-man handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch xfce4-power-manager handles these eve>
1 inhibitors listed.
Clearly the xfce4-power-manager
was messing.
I opened sfce4-settings-manager
-> Power Manager
and there I found there were two options for Lid closed on docked or undocked laptop which I had to configure to "suspend". Did that and all worked all right.