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.

  • 1
    Does it work reliably with any other operating systems? Without confirmation either way, this looks more like a hardware problem than an OS problem – Fox Sep 1 '17 at 0:20

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.
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

|improve this answer|||||
  • More recent distributions don't use rc.local by default. After creating the /etc/rc.local file as described above, re-enable its use with: 1. Put this in /etc/systemd/system/rc-local.service: [Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target 2. systemctl enable rc-local – jvd10 Feb 16 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.