Bug 82925 - UPower 0.99.0 ignores CriticalPowerAction, defaults to HybridSleep
Summary: UPower 0.99.0 ignores CriticalPowerAction, defaults to HybridSleep
Status: RESOLVED FIXED
Alias: None
Product: upower
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-21 21:38 UTC by poinck
Modified: 2014-09-02 19:57 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
upower -d (1.96 KB, text/plain)
2014-08-21 21:48 UTC, poinck
Details
UPower.conf with option CriticalPowerAction=Hibernate (2.77 KB, text/plain)
2014-08-21 22:00 UTC, poinck
Details
daemon: Add helper to get string from config (1.19 KB, patch)
2014-08-25 15:06 UTC, Bastien Nocera
Details | Splinter Review
linux: Respect the CriticalPowerAction config option (1.30 KB, patch)
2014-08-25 15:06 UTC, Bastien Nocera
Details | Splinter Review
upower-0.99.0_patch-configure-make.log (16.16 KB, text/plain)
2014-08-30 13:56 UTC, poinck
Details
upower-0.99.1-r1.ebuild (Gentoo) (2.18 KB, text/plain)
2014-08-30 13:58 UTC, poinck
Details
linux: Respect the CriticalPowerAction config option (1.77 KB, patch)
2014-08-30 17:27 UTC, Bastien Nocera
Details | Splinter Review
daemon: Add helper to get string from config (1.19 KB, patch)
2014-08-30 17:30 UTC, Bastien Nocera
Details | Splinter Review
linux: Respect the CriticalPowerAction config option (1.30 KB, patch)
2014-08-30 17:30 UTC, Bastien Nocera
Details | Splinter Review
upower-0.99.1-r1_emerge-before-after.log (Gentoo) (108.17 KB, text/plain)
2014-09-02 18:45 UTC, poinck
Details

Description poinck 2014-08-21 21:38:11 UTC
I am facing an hardware-issue with "HybridSleep", so I set the CriticalPowerAction to "Hibernate" in UPower.conf. After reloading the upower-systemd.unit I still get critical-action "HybridSleep" from "upower -d". So I had a look into the code and didn't find a trace where this Parameter is read.
Comment 1 poinck 2014-08-21 21:40:30 UTC
I use UPower 0.99.0-r1 together with systemd 215-r3 on Gentoo.
Comment 2 poinck 2014-08-21 21:48:10 UTC
Created attachment 105065 [details]
upower -d
Comment 3 poinck 2014-08-21 22:00:03 UTC
Created attachment 105066 [details]
UPower.conf with option CriticalPowerAction=Hibernate
Comment 4 poinck 2014-08-22 16:00:51 UTC
The method up_backend_take_action(...) calls logind to do the actual sleeping and hibernating. This method defines a field for supported Hibernate modes starting with HybridSleep, then Hibernate and then PowerOff. It then probes for the ability to Hibernate in that order but never reads any variable with the setting of CriticalPowerAction. So it will always try the "best" method regardless of the user setting.
Comment 5 Bastien Nocera 2014-08-25 15:06:06 UTC
Created attachment 105242 [details] [review]
daemon: Add helper to get string from config
Comment 6 Bastien Nocera 2014-08-25 15:06:09 UTC
Created attachment 105243 [details] [review]
linux: Respect the CriticalPowerAction config option

It was documented, but the configuration was never actually read.
Comment 7 Bastien Nocera 2014-08-25 15:07:35 UTC
(In reply to comment #4)
> The method up_backend_take_action(...) calls logind to do the actual
> sleeping and hibernating. This method defines a field for supported
> Hibernate modes starting with HybridSleep, then Hibernate and then PowerOff.
> It then probes for the ability to Hibernate in that order but never reads
> any variable with the setting of CriticalPowerAction. So it will always try
> the "best" method regardless of the user setting.

Doh!

Can you please test those 2 attached patches, which should fix it.
Comment 8 poinck 2014-08-27 19:07:32 UTC
(In reply to comment #7)
> Can you please test those 2 attached patches, which should fix it.

Yes, I'll let you know about the results.
Comment 9 poinck 2014-08-30 13:55:10 UTC
I am not sure if the patches work. portage (Gentoo) doesn't complain applying the patches to version 0.99.1 . But after reinstalling my custom ebuild, the output of "upower -d" still tells that it is configured with "critical-action: HybridSleep". I have to say, this is my first ever edited ebuild (see attachment). I didn't try to build an ebuild for version 0.99.0, yet.

I tried to apply the patches manually on the sources for both versions 0.99.0 and 0.99.1. Both patches seem to be correctly applied on both versions and sources still compiled. I did not "make install" outside of portage. I will attach a log of the manual patching, configuring and compiling of upower-0.99.0 . Please tell me if I made a mistake here.
Comment 10 poinck 2014-08-30 13:56:13 UTC
Created attachment 105466 [details]
upower-0.99.0_patch-configure-make.log
Comment 11 poinck 2014-08-30 13:58:13 UTC
Created attachment 105467 [details]
upower-0.99.1-r1.ebuild (Gentoo)
Comment 12 Bastien Nocera 2014-08-30 17:27:04 UTC
Created attachment 105476 [details] [review]
linux: Respect the CriticalPowerAction config option

It was documented, but the configuration was never actually read.
Comment 13 Bastien Nocera 2014-08-30 17:30:31 UTC
Created attachment 105477 [details] [review]
daemon: Add helper to get string from config
Comment 14 Bastien Nocera 2014-08-30 17:30:45 UTC
Created attachment 105478 [details] [review]
linux: Respect the CriticalPowerAction config option

It was documented, but the configuration was never actually read.
Comment 15 Bastien Nocera 2014-08-30 17:32:37 UTC
The "daemon: Add helper to get string from config" patch was broken, we were trying to read an integer instead of a string.

Please try again.
Comment 16 poinck 2014-09-02 18:45:07 UTC
Created attachment 105631 [details]
upower-0.99.1-r1_emerge-before-after.log (Gentoo)

So far so good, the patch seems to work. (o: 

"upower -d" prints out the configured "critical-action: Hibernate" (see full log with patches applied and installed). I am waiting now for the battery to go critical to confirm that upower actually tells systemd to hibernate instead of hybrid-sleeping.
Comment 17 poinck 2014-09-02 19:26:49 UTC
The test was successful! The system did go to hibernate on critical power as configured.
Comment 18 Bastien Nocera 2014-09-02 19:57:38 UTC
Attachment 105477 [details] pushed as 07fa35c - daemon: Add helper to get string from config
Attachment 105478 [details] pushed as 6573310 - linux: Respect the CriticalPowerAction config option


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.