2

I have tried to change the low and critical battery thresholds but the OS still does not seem to recognize that.

What I have tried:

  1. Changing /etc/UPower/UPower.conf to:
    UsePercentageForPolicy=true
    PercentageLow=30
    PercentageCritical=20
    PercentageAction=20
    CriticalPowerAction=HybridSleep

The file maintains the modifications but still the laptop notifies me of low battery at the default 10%

  1. Changing the same values with dconf-editor in org -> gnome -> settings-daemon -> plugins -> power

Still the laptop notifies me when the battery reaches 10% instead of 30%.

  1. using the command line, like: gsettings set org.gnome.settings-daemon.plugins.power percentage-low 30

The the laptop continues to behave as if there's no change. I have been trying to solve this problem for weeks but I couldn't find a way. I searched a lot on the internet but couldn't find anything that could solve this issue. Any help would be greatly appreciated.

EDIT 1:

Thank you sancho.s for your great suggestions. I did set the use-time-for-policy value to false already. I double checked and it seems that is indeed false.

Your temporary workaround unfortunately doesn't seem to work. I calculated the ratio you mentioned and I had it at 5%. I changed it to 30% by modifying alarm to a number 6x higher. Nothing seems to happen when the battery reaches 30%.

The related links were indeed useful but I already read those answers previously, and tried the suggestions in them, which I also reported in my original question. Unfortunately I couldn't solve the problem.

The version of my Ubuntu is 20.04 LTS, and it's running on a Thinkpad X1. I should point out that I formatted my laptop a few weeks ago, and before formatting, UPower was working correctly on 20.10. Afterwards I changed in the BIOS settings the AHCI to RST but I reverted all the changes before formatting and installing 20.04 LTS. I thought this might be related, but I reverted all the changes and I wouldn't know what to check to make sure there isn't a problem there.

stacknux
  • 21
  • 3
  • The Gnome settings are generally ignored when it comes to the notification. Generally how long can your battery last when it hits 30%? 20 minutes? – matigo May 22 '21 at 11:13
  • At 30% my battery might last 2 or 3 hours, depending on usage. I did also try to change the UPower settings manually but to no avail. – stacknux May 22 '21 at 12:33
  • I want to commend your very unusual detailed question and edits. It really helps others help you. Your last paragraph suggests some (cumbersome) things you could try. – sancho.s ReinstateMonicaCellio May 22 '21 at 14:00
  • Thank you. Could you please be more detailed on which cumbersome things I could try? I really wouldn't know what to try regarding AHCI and I am not even sure it might be related to my problem. – stacknux May 22 '21 at 15:46
  • Check independently if Ubuntu 20.10 with the various BIOS configurations works. Then try with Ubuntu 20.04. – sancho.s ReinstateMonicaCellio May 23 '21 at 19:17
  • 1
    I checked both 20.10 and 20.04 (live) with the various BIOS configurations, and UPower seems to work fine in all of them. I am inclined to think now that the problem might be related to something in my current system, maybe some program or some configuration that I have changed or that in some way is interfering with UPower. – stacknux May 24 '21 at 13:31

2 Answers2

1

I did not identify anything wrong with what you did. Even so, try gsettings set org.gnome.settings-daemon.plugins.power use-time-for-policy false, and rebooting. Or sudo systemctl restart upower.service should preform the same as rebooting.

As a workaround, there are two relevant files in /sys/class/power_supply/BAT0 (this location may change depending on the computer, you can easily find it with locate BAT0 assuming your is BAT0). Check the values in energy_full (the same as in variable POWER_SUPPLY_ENERGY_FULL of file uevent) and in alarm. The ratio gives you the percentage for an alarm, in my case alarm/energy_full=5%. You can set it to 10% by calculating target=10%*energy_full, and using that number in echo <target> | sudo tee /sys/class/power_supply/BAT0/alarm. YMMV.

In the meantime, please post the brand/model of your computer and Ubuntu version.

Related:

  1. How to change critically low battery value?
  2. Laptop not shutting down on low power
  3. Difference between dconf power settings and Upower.conf?

Related to .../BAT0/...:

  1. https://www.reddit.com/r/Ubuntu/comments/9l5nkv/need_solution_to_handle_low_battery_protocol_with/
  2. https://unix.stackexchange.com/questions/84437/how-do-i-make-my-laptop-sleep-when-it-reaches-some-low-battery-threshold
  3. https://linrunner.de/tlp/index.html
0

All the percentage values need to be descending (PercentageLow>PercentageCritical>PercentageAction), otherwise the defaults will be loaded for all values. This condition is not met in your configuration, where PercentageCritical=PercentageAction. I checked the source code of upower and the condition is really defined this way in src/up-daemon.c.