Skip to content

Instantly share code, notes, and snippets.

@miraclx
Last active January 18, 2021 07:45
Show Gist options
  • Select an option

  • Save miraclx/dffbd852c9d7ea4e83bd4760ac9e5c11 to your computer and use it in GitHub Desktop.

Select an option

Save miraclx/dffbd852c9d7ea4e83bd4760ac9e5c11 to your computer and use it in GitHub Desktop.
Instructions for disabling hibernate/hybrid sleep when battery critical on Linux
First, not hibernate
You actually want to disable hybrid sleep
You may not already know it, but trust me
That's what you want
Okay? Good
Now lets go
First, check that UPower's critical action
is set to "HybridSleep"
File: /etc/UPower/UPower.conf
...
CriticalPowerAction=HybridSleep
...
Next, reload the UPower daemon
$ sudo systemctl restart upower
Check that it has taken hold
$ upower -d | grep critical-action
If you don't see "HybridSleep", check that you can HybridSleep
$ gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanHybridSleep
You should see ('yes',)
If not, make sure your hybrid-sleep target isn't masked
$ sudo systemctl status hybrid-sleep.target
$ sudo systemctl unmask hybrid-sleep.target
$ sudo systemctl status hybrid-sleep.target
Once upower -d's critical action is HybridSleep
Now, modify the systemd unit for handling
hybrid sleep
$ sudo systemctl edit systemd-hybrid-sleep --full
...
-ExecStart=/usr/lib/systemd/systemd-sleep hybrid-sleep
+ExecStart=true
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment