DEV Community

Tuan Tu Tran
Tuan Tu Tran

Posted on

How to keep your Ubuntu laptop running with the lid closed

I have a Dell laptop running Ubuntu 20.04 that I use for remote work. By default, the laptop goes into suspend mode when I close the lid, which causes me to lose my connection. To prevent this, I followed the instructions in this guide [1] and edited the /etc/systemd/logind.conf file to set the HandleLidSwitch parameter to "ignore":

HandleLidSwitch=ignore

Then, I restarted the login service by using the following command:

sudo systemctl restart systemd-logind.service

According to the guide, this command may restart the session, so it's important to save all current work beforehand. However, in my case, the session did not restart, and the laptop continued to work as expected even after I closed the lid.
Reference:
[1] https://ubuntuhandbook.org/index.php/2020/05/lid-close-behavior-ubuntu-20-04/

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more

👋 Kindness is contagious

Sign in to DEV to enjoy its full potential—unlock a customized interface with dark mode, personal reading preferences, and more.

Okay