Linux – How to ignore lid switch action

acpiconfigurationhardwarelinux

When I close the lid of my laptop, the computer shuts down immediately and won't power on again. I need to take a screwdriver and disconnect-reconnect the battery in order to make it power on.

I really want Linux to ignore the lid switch.

I already tried a lot of answers on stack overflow but none works. What I tried:

  • Put HandleLidSwitch=ignore in /etc/systemd/logind.conf

  • systemd-inhibit --what=handle-lid-switch sleep 1d

  • cat /etc/systemd/logind.conf | grep -i lid does throw nothing

  • Put IgnoreLid=true in /etc/UPower/UPower.conf

  • systemctl unmask sleep.target suspend.target

  • /etc/acpi/lid.sh does not exist

  • In gconf-editor, in apps > gnome-power-manager > buttons, set lid_ac and lid_battery to nothing

I reboot my computer after changing those config files to be sure all services are restarted.

How is this possible? What could I try next in order to make the lid switch be ignored?

I'm using Ubuntu with Cinnamon.

Best Answer

Ok, so this is actually pretty easy... but was really difficult to find.

  1. Find the node for the lid device in /proc/acpi/wakeup:
grep LID /proc/acpi/wakeup
LID0      S3    *enabled   platform:PNP0C0D:00

(the node is 'PNP0C0D:00')

  1. As root, create an rc.local file (with the contents below) that will disable the device at boot time. Make this file executable.
#!/bin/bash
echo PNP0C0D:00 > /sys/bus/acpi/drivers/button/unbind

If you're using systemd, it should automatically detect this and execute it on boot. This completely disables the switch and allows the laptop to boot even with the lid closed.

You can look way down at the bottom of this page for some more information: https://dev1galaxy.org/viewtopic.php?id=2021

Related Question