Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: 3rd time's the charm

If you do not want your Ubuntu system from sleeping.

Command

Can be ran Run as both root or non-root privileges 

Code Block
languagecpp
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

To re-enable:

Code Block
languagecpp
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

...

cd /etc/polkit-1/localauthority/50-local.d/
touch com.ubuntu.disable-suspend.pkla
nano com.ubuntu.disable-suspend.pkla

##insert the following
[Disable suspend (upower)]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no
ResultInactive=no
ResultAny=no

[Disable suspend (logind)]
Identity=unix-user:*
Action=org.freedesktop.login1.suspend
ResultActive=yes
ResultInactive=no
ResultAny=yes

[Disable suspend when others are logged in (logind)]
Identity=unix-user:*
Action=org.freedesktop.login1.suspend-multiple-sessions
ResultActive=yes
ResultInactive=no
ResultAny=yes

##save and reboot system

Solution found from this thread: https://askubuntu.com/questions/47311452908/how-doto-i-disable-mysuspend-systemin-from-going-to-sleep14-04

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@209e85
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("sleep","disable","timer","ubuntu") and type = "page" and space = "ESKB"
labelsDisable ubuntu sleep timer

...

Page Properties
hiddentrue


Related issues