How to disable auto sleep in Ubuntu 18.04

51,333

I finally found a solution looking through some other threads. Here's what I did:

  1. Install gnome-tweak-tool: sudo apt install gnome-tweak-tool

  2. Run gnome-tweaks.

  3. Change the option under "Power" for "Suspend when laptop lid is closed" to "off".

Now the monitor only turns off the screen when the lid is closed, and no longer goes to sleep.

This doesn't really resolve the issue of sleep-looping in case I ever wanted the laptop to actually go to sleep, but it's a good enough solution for me at least.

Share:
51,333

Related videos on Youtube

Steel
Author by

Steel

Updated on September 18, 2022

Comments

  • Steel
    Steel over 1 year

    I recently installed Ubuntu 18.04 in a rather old laptop I have, and am having some major issues with the device going to sleep and then getting stuck in a loop where it goes to sleep every five seconds once woken up. It is a Lenovo G555-0873, and if it works great and fine when coming up after a fresh reboot, but if it ever sleeps, then it gets stuck constantly trying to sleep and is incredibly difficult to troubleshoot because I have to complete every interaction in the ~5 seconds I have before it sleeps again. I've tried disabling it from going to sleep at all by changing the following settings:

    In Privacy, I've turned off Screen Lock.

    In Power, I've turned off "Dim screen while inactive", set "Blank screen" to never, and turned off "Automatic suspend"

    I can't find any other settings that seem like they would effect this sort of thing. Per an old thread on a similar issue, I've also run the following command:

    xset -dpms
    

    None of this has seemingly had any effect. The laptop still goes to sleep when left idle, and then proceeds to enter it's strange sleep-loop when brought back up, and loops like that until eventually rebooted. Any assistance or suggestions are appreciated.

    Edit: I've determined now that it only happens when the lid of the laptop is shut. If I leave it with the lid open and the laptop idle it never goes to sleep, but it still sleeps instantly once I shut the lid (and then begins the hell of sleep-looping after waking up).

    • N0rbert
      N0rbert almost 6 years
      See askubuntu.com/a/1014968/66509 - is it your issue?
    • Steel
      Steel almost 6 years
      Thanks for the response N0rbert, but unfortunately no. As mentioned in my description I have already turned off that setting.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix almost 6 years
      What does grep Lid /etc/systemd/logind.conf report?
    • Steel
      Steel almost 6 years
      Here's the output from that grep command: $ grep Lid /etc/systemd/logind.conf #HandleLidSwitch=suspend #HandleLidSwitchDocked=ignore #LidSwitchIgnoreInhibited=yes But, I'm not too concerned with changing that anymore. My answer below works for me now.
  • Sruli
    Sruli over 5 years
    Thanks, that solved the suspend for me, but is there anyway to invoke screen-lock on closing the lid?
  • markackerman8-gmail.com
    markackerman8-gmail.com over 4 years
    Nope did not help! Sadly
  • dasup
    dasup about 4 years
    Thank you Steel for pointing this out. I hope that this setting will help me get rid of unwanted suspends when my laptop is idling in his dock with the lid closed (since I use an external display). Sadly enough, in the GNOME Control Center under Energy, the switch labeled "Automatic suspend" was already set to "Off", while switch in gnome-tweaks was set to "On". Sadly, GNOME deteriorates with every release due to developers with a peculiar sense of usability and "what the users need".