How to make Ubuntu suspend when we close the laptop lid

Dell XPS 13 Ubuntu Developer Edition

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:


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.

9 comments, leave yours

Leave a Comment

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



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Antonio Arias placeholder image said

    "After installation we will write the following:"
    What to type in the terminal does not appear

  2.   The Sociable Monkey said

    Chamatrix Xamanek Martinez Marin

    1.    Xamanek Martinez Marin said

      I already told you that it is not suspension, it is something else

    2.    Xamanek Martinez Marin said

      Nor is it hibernation: V

    3.    The Sociable Monkey said

      It's Nirvana

    4.    Xamanek Martinez Marin said

      Nor is it hibernation: V

  3.   Pauet said

    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.

  4.   Gerson Celis said

    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

  5.   Nicholas said

    Works on Ubuntu 18.04.01 LTS, tested!