3

A friend recently told me that it is important to not charge the laptop battery fully, so that it lives longer. I didn't know if that is true, and if it is I would expect the battery hardware or the OS to handle that without me fiddling with it.

To back this claim up, here's a quote from Lenovo's Vantage Tool on Windows:

If you primarily use your computer with the AC adapter attached and only infrequently use battery power, you can increase the lifespan of the battery by setting the maximum charge value to below 100%. This is useful because batteries that are used infrequently have a longer lifespan when they are maintained at less than a full charge.

I have a ThinkPad X1 Yoga with Ubuntu 18.04, but I expect the answer not to be strongly dependent on the laptop model and the Ubuntu version.

What kind of battery management is preinstalled on Ubuntu without further configuration?

I am thinking of things like the following:

  • stops charging at XX%
  • warns at low battery
  • hibernates on critical battery level

I am worried I might be destroying my battery's life by leaving the laptop constantly plugged in over a few weeks.

In the case that Ubuntu does not already have precautions set up, please also mention in your answer a suggestion regarding this.

lucidbrot
  • 1,311
  • 3
  • 18
  • 39
  • 4
    The problem with "proper" battery maintenance advice is that most of it is based on hearsay from the days when Nickle-Cadmium batteries were the norm. Modern machines do not need people to think about the batteries for the most part. Based on my own experience with modern batteries on multiple platforms, the rule of thumb seems to be: If you have battery, use the thing, otherwise it will not be very reliable when you actually need it to give you a half day worth of operational time. However, this is also hearsay. Modern OSes generally have you covered. –  Dec 24 '20 at 14:58
  • 3
    I agree with @Matigo here. I would like to add on one thing as well through my own experience. I have found that letting a battery drain completely then not apply any charge to it for a long time is actually extremely bad on the battery. I have 2 laptops here that have sat for over a year since I have used them. The batteries in them were quite new before they sat there. Well, now their batteries are completely dead and I will need to replace them again. I also have a hybrid-smartwatch where they do say do not let the battery drain all the way or it will not recharge. – Terrance Dec 24 '20 at 15:04
  • @karel I think you flagged in the wrong tab! – Martin Thornton Dec 30 '20 at 12:02

1 Answers1

2

NOTE: This answer had been edited majorly, introducing significant semantical changes:

Assumedly valid for both Ubuntu 18.04 and 20.04:

The default Gnome Settings app offers blanking the screen, switching off bluetooth and wifi to save battery power, and auto-suspending when idle, in the range from 15 mins to 2 hours.

GUI for advanced battery-management options:

I don't know where is the GUI for adjusting the below discussed settings. What I mean is, it might got nuked, which is a trend these years with the default Ubuntu experience (Gnome 3 desktop).

Where are the actual configs:

Battery-related settings now exist redundantly in the system, which is highly misleading.

With that said, they are probably in /etc/UPower/UPower.conf, as pointed out by @hackerb9 (thanks for the find, @lucidbrot)

Additionally, they are present among the system-wide application settings, accessed via the gsettings API, exposed by the optionally installable application, dconf-editor.

Those ones in gsettings are organized in the org.gnome.settings-daemon.plugins.power namespace, and apparently they do not take effect.

I take this from the above linked answer by @hackerb9, plus the telling comment section under this blog article.

(Actually, some settings in that gsettigs namespace keep taking effect, just not the ones that are introduced below.)

What can be configured:

There is a choice whether one wants to work in terms of battery level percentage or in terms of remaining time (gsettings default: time, UPower.conf default setting: percentage).

The following can be configured as both percentages and remaining time, both in UPower.conf and in gsettings, defaults being the same among them:

  • from where it is considered low (default: 10% or 1200secs)
  • from where it is considered critical (default: 3% or 300secs)
  • level at which an automatic action is taken (default: 2% or 120secs)

Critical battery action choices in UPower.conf:

hybridSleep | hibernate | shutdown (default: hybridSleep, with fallback to the other options)

Critical battery action choices in gsettings:

suspend | hibernate | shutdown | and other options (default: suspend)

Worth repeating, it's likely the ones in gsettings do not play a part any more.

Now for another thing to ponder over: the UPower.conf file starts with the following comment:

Only the system vendor should modify this file, ordinary users should not have to change anything.

Ubuntu Help on power/battery topic

(apparently for 20.10, in other words Gnome 3 (shared by 18.04)):

https://help.ubuntu.com/stable/ubuntu-help/power.html.en

Battery care via additional software:

This article commends TLP for 18.04 and higher.

TLP is well-discussed on this forum. It seems to have pretty fine-grained settings for when to start and when to stop charging, but these settings are vendor-specific (IBM/Lenovo ThinkPad, when additional dependencies are met).

Battery care via BIOS:

If you primarily use your computer with the AC adapter attached and only infrequently use battery power

In my Dell laptop's BIOS menu, there is a dedicated checkbox for exactly this use case. IIRC it's not being explained, how Dell will protect the battery, but the presence of this checkbox suggests that they are doing something differently then. So also take a good look around in your BIOS menu.

A relevant admission:

Perhaps I should have checked the aforementioned kept-on-charger BIOS checkbox, because that was my use case too. But I found it too late.

So, possibly - but not proven - due to this after 4 years, my battery has swollen to double its original thickness, and had to be removed. Due to this, right now I can't test or confirm any battery-related behaviour.

Levente
  • 3,961
  • Thank you for your answer. I have in the meantime also found this answer from 2017 which agrees with you that the action to take exists, but states that the gsettings/dconf are ignored and should be directly set in the upower config. It's confusing to me why both exist - do you happen to know more? Or should I ask this as a new question? – lucidbrot Dec 26 '20 at 13:34
  • 1
    "It's confusing to me why both exist" Anyone feel free to correct me on this, but I think it's because Ubuntu keeps switching its default desktop environment, and with it, the development teams: around 2011 from Gnome 2 to Unity (for better mobile platform compat), and then in the more recent years, from Unity to Gnome 3 (dunno why). Both of these switches were pretty dramatic even as an end-user, and I believe this contributes a lot to how a lot of things under the hood are redundant or unintuitive. – Levente Dec 26 '20 at 14:20
  • so that means that 2017 answer was correct, but for newer ubuntu (18.04, 20,04) it's again the other way around? Thanks! How could I have figured this out on my own? – lucidbrot Dec 26 '20 at 14:22
  • Also, I take it from your answer that there is no builtin option to charge the battery only to XX% (where XX < 100). Is that right? If so, then I think you have answered my question well. I'll accept it tomorrow, just in case somebody else has something to add :) – lucidbrot Dec 26 '20 at 14:24
  • 1
    "it's again the other way around?" I did not say that. I don't know, and can't figure out, because I'm going without a battery now. One way would be to test each of the methods separately, and find out which one is the one that actually takes effect. – Levente Dec 26 '20 at 14:25
  • 1
    I can however see that when I change settings in the "Power" section of the default 20.04 settings app, some of those changes (namely, the sleep-inactive-ac-timeout and sleep-inactive-ac-type settings) show up immediately in the org.gnome.settings-daemon.plugins.power namespace in dconf-editor. So either it's still partially used, or they might even be just written there as a legacy thing...? Not having a battery right now, I can't figure it further. – Levente Dec 26 '20 at 14:38
  • Then I shall report back once I've gotten around to testing it. Can't promise how soon that will be though. – lucidbrot Dec 26 '20 at 15:20
  • 1
    I can confirm that PercentageLow=20 triggered a info popup in the gui whereas the gsettings get org.gnome.settings-daemon.plugins.power percentage-low is set to 25 and did not trigger that info. What's also interesting is that upower -d reported 10 minutes longer remaining until empty than the info popup. The gsettings PercentageAction is set to 9 and the upower also to 9? – lucidbrot Dec 30 '20 at 11:08