Skip to content
Follow
Ubuntu Linux

Disable Laptop Suspend When Lid Closes in Ubuntu

Richard
Written by
Richard
Sep 5, 2022 Updated Sep 15, 2026 2 min read
Enable Auto Login on Ubuntu Linux: Step-by-Step Guide
Enable Auto Login on Ubuntu Linux: Step-by-Step Guide

Disabling the laptop suspend feature when the lid closes in Ubuntu prevents your computer from entering sleep mode when you shut the screen. Ubuntu 22.04 and later versions normally suspend the system to save battery power, but stopping this action lets you run long file downloads or server tasks without interruption.

Advertisement

You can change this behavior by editing a single plain-text configuration file in the system settings to tell Ubuntu to ignore the closed lid.

⚡ Quick Answer

Edit the logind.conf file to change HandleLidSwitch to ignore. Then, restart the systemd-logind service to apply the changes. Alternatively, use Gnome Tweaks and disable the suspend option.

Advertisement

How to keep the laptop on when the screen is closed in Ubuntu Linux

Ubuntu disable lid suspend settings can be changed by editing the systemd logind configuration file so your laptop stays awake when you shut the screen. You need to open the terminal, edit the logind.conf file, and change the HandleLidSwitch setting to ignore. This keeps downloads running and lets you use an external monitor with the lid closed.

To stop Ubuntu Linux from suspending when the lid is closed, follow these steps:

These steps use systemd, the background service manager in modern Linux.

First, press the Ctrl+Alt+T keyboard shortcut to open the command console, often called a terminal.

Advertisement

Open your terminal and run the following commands:

sudo gedit /etc/systemd/logind.conf

This will open a configuration file. Look for the line:

#HandleLidSwitch=suspend
Ubuntu logind.conf file with HandleLidSwitch set to ignore
ubuntu linux lid close action ignore

Change it to:

HandleLidSwitch=ignore
Ubuntu terminal showing HandleLidSwitch=ignore configuration change
ubuntu linux lid close action to ignore

Save your changes and exit the editor.

Advertisement

Next, run the commands below to apply your changes.

sudo systemctl restart systemd-logind.service

Finally, restart your computer and test to see if it works.

If those steps don't work, install GNOME Tweaks, a tool that manages desktop settings.

Run the commands below to install.

Advertisement
sudo apt install gnome-tweaks

After installing the app, go to the Activities overview and search for Tweaks.

Ubuntu Tweaks application search and launch screen
ubuntu tweaks search launch

Under General, toggle the switch to Off for Suspend when the laptop lid is closed.

Ubuntu Tweaks power settings showing lid close action options
ubuntu linux tweak lid close action

That should do it!

Conclusion:

  • Ubuntu Linux provides a straightforward way to change the laptop lid close behavior to "ignore," allowing users to avoid automatic suspension when the lid is closed.
  • Modifying the HandleLidSwitch parameter in the login.conf file or utilizing the Gnome Tweaks application, users can keep their laptop running even when the screen is closed.
  • With these simple steps, Ubuntu Linux users can ensure their work continues uninterrupted when the laptop lid is closed, providing greater flexibility and control over power management.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install RabbitMQ on Ubuntu Linux
Ubuntu Linux How to Install RabbitMQ on Ubuntu Linux
How to Start, Stop, and Restart Services in Windows 11
Windows How to Start, Stop, and Restart Services in Windows 11

No comments yet — be the first to share your thoughts!

Leave a Comment

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