How to ignore when your laptop lid closed on Ubuntu
Ubuntu is a best operating system for development ever. Still, there are some problems, of course.
If you have been using ubuntu on your laptop machine, if you close the lid, a lots of ongoing process will be closed as well. For example, If you’re on the machine through SSH, the SSH connections will be terminated immediately after closing the lid. It’s not good, Isn’t it?
As a default setting, It’s a suspend as the action of closing lid. To change this setting, you need to follow following steps.
Fist, open the setting files on a text editor as elevated user.
sudo -H gedit /etc/systemd/logind.conf /etc/UPower/UPower.conf
In the former file, change the line as following one.
- #HandleLidSwitch=suspend + HandleLidSwitch=ignore
In the latter file, change the line as following one.
- IgnoreLid=false + IgnoreLid=true
To apply those changes, you need to restart the system.
sudo systemctl restart systemd-logind
If you’re using some certain software such as Anydesk, it’s likely it won’t be ablt to use the software correctly but kind of buggy, In that case, It’s good idea to reboot your machine once.
Above instruction is compliant with Ubuntu 18.04. So If you have problem while following the steps, I recommend to take a look following references.