Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] How can I hibernate at a specific battery level

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
derul
Posts: 15
Joined: 2013-09-30 13:05
Been thanked: 2 times

[Solved] How can I hibernate at a specific battery level

#1 Post by derul »

Hi,

I'm running debian 8 jessie with gnome.
I would like to make my system hibernate when battery level is at a certain point, say 30%.

What I tried so far:
Gnome power manager doesn't have an option of changing the critical battery value.
dconf-editor also doesn't give that option.
I also tried to follow another suggestion in archwiki creating a udev rule, but it seems that my battery doesn't sent events to udev (no reports using: "udevadm monitor --property" and "cat sys/class/power_supply/BAT0/alarm" gave 0).

Thanks.
Last edited by derul on 2017-04-04 14:15, edited 2 times in total.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: How to hibernate at specific battery level

#2 Post by phenest »

ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

derul
Posts: 15
Joined: 2013-09-30 13:05
Been thanked: 2 times

Re: How to hibernate at specific battery level

#3 Post by derul »

Thanks for the reply, the script on that post is for ubuntu and needs tweaking for a debian system(files /sys/devices/platform/smapi/BAT0/remaining_percent and /sys/devices/platform/smapi/BAT0/state don't exist on my system)

There must/should be a simpler solution for this trivial task than creating custom scripts.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: How to hibernate at specific battery level

#4 Post by pylkko »

I think... (haven't tried) that you can adjust the values in /etc/UPower/UPower.conf. But in reality this may be more complicated as many Desktop Environments might have their own settings that may or may not override the settings that you manually change.

in my file it says

Code: Select all

PercentageLow=10
PercentageCritical=3
PercentageAction=2
CriticalPowerAction=HybridSleep
So at 10% I get a low power notification. Another one saying that system will now shut down at 3% and at 2% it goes into hybrid sleep. You can probablt change these values, for example if you have a battery that cannot provide sufficient voltage any more at, say 7%, then you could put CriticalPowerAction to 8%

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: How can I hibernate at a specific battery level

#5 Post by debiman »

derul wrote:Gnome power manager doesn't have an option of changing the critical battery value.
dconf-editor also doesn't give that option.
wow. reasons to not use gnome just keep piling up.
i know that xfce4-power-manager can do what you want, and it doesn't require a fullblown xfce desktop.
but gnome's powermanager than would probably interfere...

i do have a simple script running for that task, on an old laptop, so that would be my simpler solution.

derul
Posts: 15
Joined: 2013-09-30 13:05
Been thanked: 2 times

Re: How can I hibernate at a specific battery level

#6 Post by derul »

pylkko wrote:I think... (haven't tried) that you can adjust the values in /etc/UPower/UPower.conf. But in reality this may be more complicated as many Desktop Environments might have their own settings that may or may not override the settings that you manually change.

in my file it says

Code: Select all

PercentageLow=10
PercentageCritical=3
PercentageAction=2
CriticalPowerAction=HybridSleep
So at 10% I get a low power notification. Another one saying that system will now shut down at 3% and at 2% it goes into hybrid sleep. You can probablt change these values, for example if you have a battery that cannot provide sufficient voltage any more at, say 7%, then you could put CriticalPowerAction to 8%
The first lines in this file state:
# Only the system vendor should modify this file, ordinary users
# should not have to change anything.
Nevertheless, (after saving a copy) I changed:
first the value of UsePercentageForPolicy to true (since default is false and "time remaining" instead of percentage is considered)
then the percentages to my liking
rebooted to make sure
and it worked!
I didn't get a message for low power (I don't recall if I was getting one before), but I got a message for critical power and one right before the hibernation (all at the specified new percentages).
I 'll give it some time to make sure things are smooth and there are no complications.
Thanks pylkko.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: How can I hibernate at a specific battery level

#7 Post by pylkko »

Yeah, I too noticed that message, but it doesn't really say why. So I suppose it might be because other settings may override or conflict with it in some distros/DE's

Post Reply