63

Subtly broken is worse than frankly broken...

Background:

  1. I already disabled suspend in System Settings -> Power.

  2. The "Suspend" option still appears on the gear menu (not that I expected it to disappear), and the sleep (moon) button on my keyboard still triggers suspend.

  3. The options in #1 are, as others have pointed out, just too easy to hit by mistake once every month or so.

  4. It seems like 1% of platforms get suspend right, because some driver engineer somewhere forgot to check that PCIe or IO space register X gets restored when upon wake. So it's worse than broken: everything usually looks fine after waking up, only it's not. And hopefully none of those corrupted registers affects reliability in a creeping manner, like ECC configuration or storage FIFO depth. But they usually do, in one form or another, which is one reason, for example, why errata against graphics drivers continue infinitely, years after they debut on the market ("graphics chip X hangs an hour after resuming from suspend blah blah blah").

  5. There should be an automated test to see what registers change across a sleep cycle, but few vendors have such a test. The test is complicated somewhat by the fact that some registers are expected to change, such as timers. And worse, sometimes you have to read registers in a certain order or with a particular granularity, or by first writing a read index somewhere else. So this process cannot be centralized at a convenient place in the industry, like Canonical's offices. It's really and truly hopeless unless PCIe is redefined in such a manner that makes comparison easy, which it won't be.

  6. The magical test suite in #5 will never be written because of the chaotic state of driver development. Hence in the absence of that, my question.

  7. I'm so desperate that I don't mind hacking on /etc/whatever_suspend_file, but it would be nice if there were a "polite" way to do this, like that nonexistent checkbox in System Settings -> Power that says "Permanently disable suspend because it was ill-conceived from day one."

  8. NB: I'm not talking about hibernation here, which shouldn't suffer from the problems above because it involves a power cycle. Although in principle, restoring registers from permanent storage could have similar problems.

Veiokej
  • 653

6 Answers6

65

According to the Debian Wiki, you can also disable it via systemd like so:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

While I have done this on my machine, I can't attest to its effectiveness. Not brave enough to try it out intentionally.

jakar
  • 761
9

On Ubuntu 16.* try this.

Go to:

  • System Settings

Click on:

  • Brightness & Lock

  • Turn screen off when inactive

  • Set it to 'Never'

Hope it helps :)

Hizqeel
  • 1,915
  • 28
  • 24
  • 24
oddCat
  • 99
6

Run the following command to open the file to edit:

sudo -H gedit /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

Scroll to the bottom. Check to see if the following information exists, and if not add them:

[Disable suspend]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no

Doing this makes suspend do nothing when you click it; it will disappear from the menu after you restart your computer.

You can run this command also to prevent computer from sleeping:

gsettings set org.gnome.desktop.session idle-delay 0
Eric Carvalho
  • 55,453
5

With dconf Editor, navigate to:

org.gnome.settings-daemon.plugins.power

You will find lots of options relating to sleep and suspend.

Anwar
  • 77,855
Jean-Marie
  • 2,018
0

In Ubuntu 20.04 Go to Settings -> Privacy -> Screen Change Blank Screen Delay To "Never"

-1

GUI

Have you looked at:

System -> Preferences -> Power Management

On AC Power Tab, Put computer to sleep when inactive for: "Never"

Terminal

Can you open up "gconf-editor"?

Look in: /apps/gnome-power-manager/timeout

Try setting sleep_computer_ac to 0

I'm not positive if anything else needs to be changed as well.

Get also a look here.

Korkel
  • 1,168