Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Configure action of laptop lid in Ubuntu

📅 2022-May-31 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ lid ⬩ 📚 Archive

Problem

I installed Ubuntu on a laptop that I wanted to use just as a SSH server. But when the laptop lid is closed it would suspend, where as I wanted it to be alive.

Solution

Open the login manager configuration file:

$ sudoedit /etc/systemd/logind.conf

Uncomment the line with HandleLidSwitch=suspend and change it to HandleLidSwitch=ignore.

Other possible options for this config are poweroff and hibernate.

Restart the service:

$ sudo systemctl restart systemd-logind

Tried with: Ubuntu 22.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧