You are not logged in.

#1 2016-06-28 10:32:24

markand
Member
Registered: 2015-04-09
Posts: 28

Suspend on low battery

Hello,

Yesterday I ran my laptop on battery and when its state was very low the laptop did hard shutdown, not clean, no suspend. This is very not nice.

My /etc/UPower/UPower.conf is as original, nothing was changed. I just wonder if it's not my laptop that shutdown by itself before reaching the UPower critical threshold. Or did I miss something to enable suspend on low battery?

I'm running GNOME 3.20.

Any help would be appreciated.

Offline

#2 2016-07-04 09:51:52

evotopid
Member
From: Switzerland
Registered: 2013-02-03
Posts: 8

Re: Suspend on low battery

I'm not an expert with this but first of all are you sure you want to suspend and not actually hibernate? Because with suspend the laptop still has to power the RAM and it is possible for it running out of power especially if the battery was already critical to begin with.

I haven't personally fiddled with UPower but I found instruction on the wiki how to hibernate on low battery using a udev rule.

Offline

#3 2016-08-24 11:42:04

markand
Member
Registered: 2015-04-09
Posts: 28

Re: Suspend on low battery

Thanks, I'll try this udev rule and see if it works!

Offline

#4 2016-08-29 18:21:32

markand
Member
Registered: 2015-04-09
Posts: 28

Re: Suspend on low battery

I've added a file as described in the wiki :

$ cat /etc/udev/rules.d/99-lowbat.rules
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-30]", RUN+="/usr/bin/systemctl hibernate"

But it does not seem to work, I've reached less than 20% of battery and it still didn't hibernate. I've then tried to run systemctl hibernate by hand and it shutdown the computer and probably crashed because on power on the filesystem was recovering, I will shutdown instead I think.

My laptop correctly emit periodic battery status as tested with udevadm monitor --property.

Do you have any other ideas?

Thanks.

EDIT: I realized that /sys/class/power_supply/BAT0/alarm is 0 though.

Last edited by markand (2016-08-29 18:27:14)

Offline

#5 2016-09-05 11:53:51

markand
Member
Registered: 2015-04-09
Posts: 28

Re: Suspend on low battery

I finally understood that the [0-30] interval is wrong. Using [0-3][0-9] works.

If you wonder why I hibernate at 30%: my laptop is old and its battery too. It does hard shutdown by itself around 25%, the battery has probably some internal failures. That's why I need to hibernate around 30%.

Offline

#6 2017-08-07 11:02:59

sitwano
Member
Registered: 2017-07-07
Posts: 83

Re: Suspend on low battery

markand wrote:

I finally understood that the [0-30] interval is wrong. Using [0-3][0-9] works.

If you wonder why I hibernate at 30%: my laptop is old and its battery too. It does hard shutdown by itself around 25%, the battery has probably some internal failures. That's why I need to hibernate around 30%.

I have a feeling you didn't set up hibernation correctly if hibernation results in hard shutdown. Did you follow instructions at https://wiki.archlinux.org/index.php/Po … _hibernate?

I added the resume option to point to my swap disk in my /etc/default/grub like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=/dev/sda3"

Then add the hook in /etc/mkinitcpio.conf and check the hook using  $mkinitcpio -L

Last edited by sitwano (2017-08-07 11:04:43)

Offline

Board footer

Powered by FluxBB