Kiriakos Naiskes

Linux: Prevent Suspend When Closing the Laptop Lid

Have you ever installed Linux on an old laptop and tried to use it over SSH, only to find out that the connection drops when closing the lid? If so, the solution is very simple.

Edit /etc/systemd/logind.conf

Set or update the following options:

HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

Restart systemd-logind

To apply the changes, restart systemd-logind (or just reboot your machine):

sudo systemctl restart systemd-logind

Date: 2025-09-27 Sat 23:45

Emacs 29.3 (Org mode 9.6.15)