Prevent Ubuntu Server from sleeping when the Lid is closed

If you are running Ubuntu Server on your laptop, you may wish to disable Lid Switch.

sudo nano /etc/systemd/logind.conf

Look for #HandleLidSwitch=suspend and change according to your liking

HandleLidSwitch=poweroff to shutdown when lid is closed

HandleLidSwitch=hibernate to hibernate when lid is closed

HandleLidSwitch=ignore to do nothing

Restart systemd service or just reboot to apply changes

sudo restart systemd-logind

Leave a Comment

Your email address will not be published. Required fields are marked *