No Hibernation action on critical battery

Today my Librem15v3 ran out of juice as I forgotten to plug it in. I was too busy to notice the low battery warning. However, to my surprise the laptop did no Hibernate when the battery went below 3% and eventually the laptop powered off comletly without a proper shutdown. I didn’t loose much work, however, upon doing a little research I realised that the UPower configuration of the laptop should have triggered a hibernation. Here is my /etc/UPower/UPower.conf settings,

# Only the system vendor should modify this file, ordinary users
# should not have to change anything.
PercentageLow=10
PercentageCritical=3
PercentageAction=2
# If HybridSleep isn't available, Hibernate will be used
# If Hibernate isn't available, PowerOff will be used
CriticalPowerAction=HybridSleep

the percentage low/critical limits seem to be working as the latop is displaying warning msgs. However, is it possible the laptop is not hybernating because it isn’t available and instead it is going into PowerOff?

I just tried to hibernate the laptop without any success by enabling the hibernate on power button press feature.

I read somewhere that hibernate uses the swap partition to save the ram to disk. My swap partition is 2Gb, is it too small to accommodate a ram image?

The swap partition for hibernation should be the RAM size and then some. 2GB seems to be much less then available ram in Librem15. Try extending its size to (RAM + 1)GB

1 Like

Swap partition size don’t need to be same as RAM but at least needs to be the same RAM that you’re using before hibernate, it’s unusual to use more than 2GB but to be sure you can set t at 3 or 4GB

1 Like

thank for that tip.

Ok, I just realised that I don’t have a swap partition… I mistook my rescue partition for the swap.

Quick question, my laptop came with its main partition encrypted (fs:crypt-luks) which occupies all the space on my ssd drive, so can I shrink it using gparted to make space for a swap partition?

[EDIT] ok, gparted does not support encrypted partitions. So the question is now, what tool can I use to shrink my partition?

Another way would be to setup a swap file and hibernate to that. But I haven’t used that in practice, let alone on an encrypted partition. So can’t help you much more.
Maybe this can get you going:
https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition

2 Likes

You can/should get your swap within the encrypted partition. Just think of it that way: if the swap is not encrypted, then your memory that does include the decryption key will be written in plain in the swap. Not good :slight_smile:

I don’t know what the default install layout was given I had a crash on first boot that broke things™, but if it’s anywhere standard you should have lvm inside the swap partition so it should be possible to resize things a bit and create a swap partition there. I’m actually surprised there wouldn’t be one by default…

1 Like

good point. I was in 2 minds as to make the swap encrypted too or not.

did you mean inside the main partition? lvm … ok so it should be possible to simply shrink the root and make space for an additional volume for the swap all within the encrypted partition. Is my reasoning on the right track here?

ya, I would have expected one too. Maybe there is a good reason why not.

thanks that is also an interesting approach.

I cam across this interesting thread about reasons why not to have swap partitions/files on high-RAM ssd systems. The author of the accepted answer suggest instead to have a suspend-to-ram which I believe my LIbrem15v3 is configured to do as the default suspend.

The initial argument to write less to an ssd would apparently be less valid with modern SSDs as their capacity for write-capacity is much higher. Anyone knows what kind of limits Librem SSDs are designed for?

Coming back to my initial question, my UPower.conf is set for,

Which according to this wiki page is possibly both a suspend-to-disk and a suspend-to-ram ? Can I do the following to simply suspend-to-ram,

CriticalPowerAction=Suspend

So at least I don’t have brutal power off.

apparently not according to this thread. The answers that suggest changing settings in the dconf-editor are not available in PureOS.

I can now happily report that with the latest PureOS update, the critical battery action is working and my librem15 now gracefully shutsdown when battery % reaches the critical setting.

1 Like

hi @mladen I am re-opening this thread as subsequent updates have broken this again. The laptop simply keeps running till the end of battery and finally switches off.

Please report to our tracker with as much details as you can gather: https://tracker.pureos.net/

1 Like

Done! Here is the tracker issue.

1 Like

I see the issue mentioned by vrata doesn’t have any updates. I have had this problem repeatedly and want to fix this. I usually observe that the laptop turns off instantly (not suspended because on power on I return to disk encryption pass-phrase and login) when the battery is somewhere between 45 or 25%. I thought previously I had seen that disk encryption would prevent suspend from happening but haven’t read enough backlog just yet.

One of the issues is the battery used by Purism on Librems are pretty much closed-source and till date they have not had any alternatives that would allow them to better integrate the battery monitoring with the system. See this post by Purism CTO @nicole.faerber.

So my guess is that until some improvement in battery tech comes along, this issue won’t be resolved.

I found your post about things to do to extend battery life. My problem is that I’m never sure when the laptop will just instantly power off due to low battery. Sometimes it is 20% sometimes it is 50%. I’ll keep looking at this from time to time.

what are your /etc/UPower/UPower.conf settings ?

and your battery status?

more /sys/bus/acpi/drivers/battery/PNP0C0A\:00/power_supply/BAT/uevent

$ cat /etc/UPower/UPower.conf | grep -v ^# | grep -v ‘^$’

[UPower]
EnableWattsUpPro=false
NoPollBatteries=false
IgnoreLid=false
UsePercentageForPolicy=true
PercentageLow=10
PercentageCritical=3
PercentageAction=2
TimeLow=1200
TimeCritical=300
TimeAction=120
CriticalPowerAction=HybridSleep

more /sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT/uevent

POWER_SUPPLY_NAME=BAT
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=11891000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=3774000
POWER_SUPPLY_CHARGE_NOW=3297000
POWER_SUPPLY_CAPACITY=87
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=S10
POWER_SUPPLY_MANUFACTURER=TPS
POWER_SUPPLY_SERIAL_NUMBER=