CriticalPowerAction=Suspend should be supported

Bug #1852911 reported by Pedro Côrte-Real
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Fix Released
upower (Ubuntu)

Bug Description

The action to take when the battery is critical can only be one of the following:

# Possible values are:
# PowerOff
# Hibernate
# HybridSleep

Adding Suspend to that list makes perfect sense. My laptop is currently powering off on low power which is useless as I'll be losing my work anyway. Might as well suspend and allow me to notice that and connect a charger. If the thinking is that suspend uses power I can set a high enough threshold to give me some margin.

The failovers are:

# If HybridSleep isn't available, Hibernate will be used
# If Hibernate isn't available, PowerOff will be used

I'd argue Suspend should actually come before PowerOff in that list. For most laptop users having their computer suspend because they didn't notice the battery was running out is very easy to fix and takes no time. They'll just connect the charger. If however the computer needs to be completely rebooted, not only does that take a lot more time it will very likely cause lost work.

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: upower 0.99.10-1
ProcVersionSignature: Ubuntu 5.0.0-32.34-generic 5.0.21
Uname: Linux 5.0.0-32-generic x86_64
ApportVersion: 2.20.10-0ubuntu27.3
Architecture: amd64
CurrentDesktop: Unity
Date: Sun Nov 17 14:32:13 2019
InstallationDate: Installed on 2019-05-09 (191 days ago)
InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Release amd64 (20190416)
SourcePackage: upower
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, it has been reported upstream as well on

Which got that reply

'Suspend still uses significant amounts of power, and if you run out of power and do a hard powerdown when suspended bad things can happen.'

Changed in upower (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

Upstream seems to be ignoring the user's wishes. Would Ubuntu be willing to take the patch?

Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

By the way the actual discussion seems to be this one:

And this is the unmerged PR with the simple patch:

Changed in upower:
status: Unknown → New
Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

Please include at least this patch on the package. It allows setting Suspend as the action but does nothing if the user hasn't explicitly done that.

Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

You may also want to consider just having Suspend be a fallback option before PowerOff. These days users are much more likely to have a laptop that suspends properly and prefer that to happen and just quickly grab a charger and continue instead of having their computer do a full poweroff.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch that keeps the defaults unchanged but allows the setting in the config file" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

I've once again lost my open session because upower has decided a shutdown is a sensible thing to do instead of just suspending and allowing me to just find a charger. Please consider this an actual bug and not just a "Wishlist" item. It's something that deeply frustrates users continuously. Orderly shutdowns are a relic of the past. Suspend or just dieing from lack of battery are both much better options for a laptop. That upstream has decided to force this behavior is unfortunate but the patches are simple enough.

Revision history for this message
Travis Downs (travis-downs) wrote :

I would like to add my voice here and say that a patch, either to upstream UPower or to Ubuntu's version would be much appreciated. I've lost work several times as neither HybridSleep nor Hibernate work on my laptop so it simply shuts down, and due to a quirk of the batter management the delay between the notification of low % and then the critical threshold and shutdown is often only mere seconds.

Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

I've attached a patch already. I've been running for over a year now with no issues.

Revision history for this message
Andrea Gadotti (aerdna-itto) wrote (last edit ):

I have found a (dirty?) workaround for this. The idea is simple: use a udev rule to suspend the laptop before UPower shuts it down. This can be done by creating a file /etc/udev/rules.d/99-lowbat.rules with the following content:

# Suspend the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="/usr/bin/systemctl suspend"

You can of course tune the threshold.

This method seems to work well for me. If you want to use a threshold that's lower than the UPower one, *I think* you could set the PercentageAction parameter to 0% or 1% in /etc/UPower/UPower.conf, although I'm not 100% sure this is a good idea (the disclaimer at the beginning of the file seems to discourage users from directly modifying the file).


On a side note, I definitely wish this bug could be addressed. It's not normal that a computer just shuts down and makes you lose your work when there's still battery. Also note that afaik there's currently no way to enable hibernation with full disk encryption, so this limitation of UPower will become increasingly serious as more and more users will make the (right) choice to use FDE.

Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

I've been running patched upower for a year and a half now. It has saved me in a few occasions. By far the most common scenario is that I've forgotten to plugin and it just suspends and I reconnect it and get going again. Shutdown is just useless, you still lose your work so might as well let the power fail completely. Ubuntu should just ship the patch.

Changed in upower:
status: New → Fix Released
Revision history for this message
Pedro Côrte-Real (pedrocr) wrote :

I don't know what automation concluded that a fix was released but what happened instead is that upstream has once again refused to address this and just closed the bug reports. I suggest Ubuntu just ship the patch in its packages.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.