Dell Laptop Does Not Suspend On Lid Close
I bought a refurbished Dell 7420e laptop
to replace my aging Dell 7470.
The 7470 has an S key that works irregularly.
After installing Arch Linux, the 7420e would not suspend when I closed the lid, it just stayed on, display lit up brightly.
It turns out that people have this problem once in a while. The solution is to enable the lid switch in BIOS.
To actually enable the lid switch in BIOS, you have to power up the laptop while repeatedly tapping the F2 “function” key. Dell BIOS has a fancy 1990s style GUI. The “enable lid switch” indicator is cleverly hidden under “Power”.
This problem seems vaguely related to the time my laptop rebooted when its lid opened..
Other Findings
systemd-logind
Systemd has a daemon systemd-logind: ps -l -p $(pgrep logind)
That daemon has a configuration file /etc/systemd/logind.conf.
The config file has a few lid-related item in it,
like HandleLidSwitch and LidSwitchIgnoreInhibited.
Both were commented on on my new-to-me laptop,
uncommenting didn’t help.
Lid state in journal
The systemd unit is “systemd-logind”.
You can uses journalctl to see when you opened and closed your laptop lid:
$ journalctl -u systemd-login
...
Jun 18 14:34:57 hazard systemd-logind[424]: Lid closed.
Jun 18 14:59:31 hazard systemd-logind[424]: Lid opened.
...
The journalctl output has a lot of other info in it.
Lid in boot message
$ sudo dmesg | grep -i lid # /etc/wpa_supplicant
...
[ 0.521539] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
[ 0.525673] ACPI: button: Lid Switch [LID0]
...
This may be what you use to see if the BIOS presents a lid switch to Linux
to put in /proc/.
The messages above are what shows up if the BIOS has lid switch enabled.
Lid state in /proc pseudo-filesystem
A little script to illustrate how you can look at lid state:
while true
do
cat /proc/acpi/button/lid/LID0/state
sleep 1
done
Even if the lid switch is enabled by the BIOS, the script above will only output a series of “open” lines, unless you’ve got some weird config. The script gets suspended along with all other running processes when the laptop lid closes.