2

I'm trying to disable suspend on my Ubuntu 17 running on HP EliteBook laptop.

I've tried:

sudo systemctl disable systemd-hybrid-sleep

Outout from systemctl status systemd-hybrid-sleep.service

● systemd-hybrid-sleep.service - Hybrid Suspend+Hibernate
   Loaded: loaded (/lib/systemd/system/systemd-hybrid-sleep.service; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-suspend.service(8)

But when I close the lid the computer still goes into suspend, and I cant wake the laptop out of it. Anyone know a solution for this?

2

Two things wrong here. First off when you disable systemd-hybrid-sleep you only disable systemd's handling of the event. The KDE/Gnome power management is still active. Second you aren't touching normal sleep at all just hybrid mode.

First off make sure suspend is off in "System Settings -> Power"

To truly disable suspend go through polkit. Both KDE and GNOME use it to track authorization for suspend/hibernate. Without that authorization the option to sleep will not even be available. I know this because GNOME used this mechanism to hard disable hibernation.

The directory "/etc/polkit-1/localauthority/" contains sub directories intended for custom setup. The directories are search in alpha numeric order with for .pkla files. All files in each directory are processed before moving to the next. The files are also handled alpha-numericly. In case of conflict the last read setting takes effect.

From a related answer to "How to disable suspend in 14.04?"

Create a new file called /etc/polkit-1/localauthority/50-local.d/com.ubuntu.disable-suspend.pkla with the following contents:

[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=no
ResultInactive=no
ResultAny=no

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

and then reboot.

This instructs polkit to refuse suspend requests. After this there shouldn't even be option to suspend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.