How to prevent Ubuntu from sleeping when closing the laptop lid

MuyLinux

How to prevent Ubuntu from sleeping when closing the laptop lid

Let’s go with a quick and a little ‘trick’ sui generis that most likely will not be of interest to a large majority, but that if necessary it may come in handy to know. And is that prevent Ubuntu from sleeping when closing the laptop lid It is something strange a priori, because why would you want to do that?

Suspension is a mode that stops the operations of all processes and saves the state of the system in the RAM memory of the computer, allowing it to start much faster than turning off and restarting the computer or using hibernation, in which the state of the system is saved in the storage of the equipment (in the swap).

If the advantage of the suspension is a faster reactivation, the disadvantage of this method is that the equipment does not turn off completely, but remains in low power mode and, therefore, continues to need power … and if it is it is finished, the equipment is shut down for real and the state is lost.

Read This Now:   How to Lock, Locate or Find a Stolen, Lost or Turned Off iPhone, iPad and iPod

Once explained what the suspension consists of – in case it was necessary that I do not believe it – we will go on to see how to prevent it from happening when the laptop lid is closed, one of the ways this energy saving mode is automatically executed… But why do it? As I say, it is something that few people will be interested in, but …

To offer the most generic answer possible, let’s say that what we are looking for is that the system continues to function normally when the lid is closed without interrupting operations (In my particular case I have an old laptop that I use as a server to test things, but there may be a multitude of reasons).

To the mess: this tutorial is aimed at Ubuntu 20.04 LTS and higher or direct derivatives because you have to pull systemd, which is evidence that it will work the same in many other Linux distributions, but since we have not tested it outside of Ubuntu, it is said .

Read This Now:   Does the TV change channels by itself? 5 solutions

We open the terminal and edit the following file with administrator permissions:

sudo nano /etc/systemd/logind.conf

Then find and change the option:

#HandleLidSwitch=suspend

First, uncomment the option (delete the hash mark) and change the parameter to “ignore”. I mean, leave it like this:

HandleLidSwitch=ignore

Save changes and restart systemd services with:

sudo systemctl restart systemd-logind

You can now close the laptop lid without Ubuntu going to sleep. If by any chance it does not work, make sure that in the previous file the following option is as is:

LidSwitchIgnoreInhibited=no

And it would be. By the way: if you use the laptop in a graphical environment, you can continue to lock it without problems.

Imagen: Pixabay


Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/gamefeve/bitcoinminershashrate.com/wp-includes/functions.php on line 5420

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/gamefeve/bitcoinminershashrate.com/wp-includes/functions.php on line 5420