Surely many of you have faced the fact that when you close the lid of the laptop, your Ubuntu does not go to sleep mode but continues to work or the screen turns off but Ubuntu continues to run. This is somewhat annoying or ineffective since the correct thing to do would be to go to sleep and save energy, either from the laptop battery or from the electrical network.
There a bug that prevents entering this mode when we close the laptop lid, a bug that has not yet been solved but can be corrected with tricks. In this case we are going to tell you a trick that will allow you to suspend the equipment when you close the laptop lid.
Ubuntu does not usually go to sleep when we close the laptop lid
First of all we have to make sure that in the Energy configuration we must have the option of «Suspension» in the section on closing the laptop lid. Still it will not work due to the mentioned bug. That is why after maintaining this configuration, we have to open the terminal and write the following:
sudo apt-get install pm-utils
After installation we will write the following:
sudo nano /etc/systemd/logind.conf
This will show us a file with several commented lines. The trick is to uncomment certain lines so that the pm-utils program works in an extraordinary way and send the computer to sleep by closing the laptop lid. So we have to uncomment the following lines:
HandleSuspendKey=suspend HandleLidSwitch=suspend HandleLidSwitchDocked=suspend
We save all the changes and restart the system. Now when we close the lid of the laptop the equipment will go into suspension with the consequent energy saving. This trick is valid with the latest versions of Ubuntu although with Ubuntu 18.04 it has not been tested. In any case, the energy savings will be considerable and the efficiency of the operating system.
"After installation we will write the following:"
What to type in the terminal does not appear
Chamatrix Xamanek Martinez Marin
I already told you that it is not suspension, it is something else
Nor is it hibernation: V
It's Nirvana
Nor is it hibernation: V
Do you know when this problem occurs, does it have to do with the computer? I have two laptops, an Acer Aspire 5740, and a Lenovo T400, with Kubuntu 16.04 (Kernel 4.4) and 17.10. And in both cases the suspension works when closing the lid.
How to add the hibernate option? It is very practical in case of closing it for a longer time, being more convenient than a suspension in terms of resources
Works on Ubuntu 18.04.01 LTS, tested!