Ubuntu 20.10: Prevent suspend on close lid

Edit /etc/systemd/logind.conf by using your favorite editor
sudo nano /etc/systemd/logind.conf
Find line “#HandleLidSwitch=suspend”

The shortcut for searching in nano is [ctrl] + [w]

Uncomment the line

remove hashtag in front of the line

Change value from suspend to “ignore”

The following values can be used:

HandleLidSwitch=hibernate –> hiberante when lid is closed
HandleLidSwitch=ignore –> do nothing when lid is closed
HandleLidSwitch=poweroff –> shutdown when lid is closed
HandleLidSwitch=lock –> lock when lid is closed


Save file

If you are using nano you can close and save the file by pressing [ctrl] + [x] then [y] and then [enter]

Reboot

reboot

Try it

2 comments

  1. thanks for the explanation,
    on my ubuntu 20.04.3 this change did not apply after saving the file
    it also didn’t apply after systemctl daemon-reload
    it only was applied after reboot

Comments are closed.