Ubuntu, a powerful and modern operation system is being used by millions of individual users and businesses around the world. From basic workstation to advanced engineering machines, Ubuntu is powering them all.

If you’re just started out with Ubuntu and need help working with it, keeping coming to this blog for help. We’ve written hundreds of posts on Ubuntu that will get you started.

From learning how install Ubuntu to configuring basic settings, we’ve have covered all.

This brief tutorial is going to show you how to configure Ubuntu on a laptop computer so that when the lid is closed, it doesn’t put the computer to sleep or shut it down.

Most modern operating systems, including Windows is designed to put the laptop to sleep when the lid is closed. Ubuntu also does this. If you only want to close the lid and not put your laptop to sleep, continue below to learn how to do it in Ubuntu.

There are two ways to go about making this work in Ubuntu. One way is to open System Settings –> Power and setting the options there. Some users have had issues where doing it from System Settings didn’t work.

Another option is go change the settings from the configuration file of the Login Manager (logind.conf). Using this method has worked for many and you should try it as well.

To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to open logind.conf file. There this file is where you’ll make this change.

sudo gedit /etc/systemd/logind.conf

 

When the file opens, modify or change line line from this:

#HandleLidSwitch=suspend

 

To this:

HandleLidSwitch=ignore

 

And save the file. After saving the file, run the commands below to reset the Login Manager.

sudo restart systemd-logind

 

That’s it!

The ignore value tell Ubuntu not to sleep or hibernate when the laptop lid is closed. Leave the rest of the line intact and save the file.

 

photo

Frequently Asked Questions

How to prevent Ubuntu laptop from sleeping when lid is closed?

To prevent your Ubuntu laptop from sleeping when the lid is closed, you can modify the logind.conf file by changing the HandleLidSwitch setting to 'ignore'. This will ensure that your laptop remains awake when the lid is closed.

What is the default behavior of Ubuntu when the laptop lid is closed?

By default, Ubuntu is designed to put the laptop to sleep when the lid is closed. If you want to change this behavior and keep the laptop awake when the lid is closed, you need to make adjustments in the system settings or logind.conf file.

How can I configure Ubuntu to keep the laptop running with closed lid?

You can configure Ubuntu to keep the laptop running with the lid closed by editing the logind.conf file and changing the HandleLidSwitch setting to 'ignore'. This will prevent the laptop from going to sleep when the lid is closed.

Are there alternative methods to prevent Ubuntu laptop from sleeping when lid is closed?

Yes, besides modifying the logind.conf file, you can also try changing the power settings in System Settings. Some users have reported issues with System Settings, so modifying the logind.conf file is another effective method.

What are the risks of keeping the Ubuntu laptop awake with closed lid?

Keeping your Ubuntu laptop awake with the lid closed may lead to increased power consumption and potential overheating if the laptop is not properly ventilated. It is important to monitor the laptop's temperature and power usage when using this configuration.

Can I revert the changes and make Ubuntu laptop sleep when lid is closed?

Yes, if you decide to revert the changes and make your Ubuntu laptop sleep when the lid is closed, you can simply edit the logind.conf file again and change the HandleLidSwitch setting back to 'suspend'. Remember to save the file and restart the Login Manager.

Will changing the logind.conf file affect other power settings in Ubuntu?

Changing the logind.conf file to prevent the laptop from sleeping when the lid is closed will only affect this specific setting. Other power settings in Ubuntu will remain unaffected, ensuring that your customization is limited to this particular behavior.

Is it recommended to keep Ubuntu laptop awake with closed lid for extended periods?

It is not recommended to keep your Ubuntu laptop awake with the lid closed for extended periods, as it can lead to unnecessary power consumption and potential hardware issues. It is advisable to allow your laptop to sleep or shut down when not in use to conserve energy and prolong the lifespan of the device.