I’ve been using this laptop for some months now (see my other posts). In Windows, you can easily set the battery charge limit to 80% using the LG Gram control center. In Linux, I did not find any specific configuration in any system settings in any DE (not even in KDE Plasma, where, for some laptops, there’s support for setting the battery charge limit).
However, since kernel 5.15, you can do it yourself, thanks to some specific LG Gram kernel features, https://www.kernel.org/doc/html/latest/admin-guide/laptops/lg-laptop.html:
Writing 80/100 to /sys/devices/platform/lg-laptop/battery_care_limit sets the maximum capacity to charge the battery. Limiting the charge reduces battery capacity loss over time.
This value is reset to 100 when the kernel boots.
So you need to write ’80’ in that file. I do that like that:
1 |
echo '80' | sudo tee /sys/devices/platform/lg-laptop/battery_care_limit |
After that, you can see that when charging reaches 80%, the laptop will not charge the battery anymore. Depending on the DE, either you see the charging notice disappear or the charging stuck at 80%. The DE might even tell you that it still needs some time until fully charged, but you can ignore that. That notice will stay like that, as shown in these two screenshots (KDE Plasma), taken at different times:
Note that in the quotation shown above, you also read
This value is reset to 100 when the kernel boots.
If you reboot, the value in that file will go back to ‘100’, and charging will effectively continue. Note that this also holds if you hibernate (suspend to disk) the laptop since when you restart it from hibernate, you’ll boot it anyway, so that will reset the value in the file. However, if you put the laptop to sleep, the value of the file will not change.
Above I said that you need kernel 5.15. I think the feature described above was introduced even before, but in kernel 5.13, that does not seem to work: no matter what you write in that file, the change will not be persisted. In my experience, this only works starting from kernel 5.15.
With kernel 5.15, it works for me in EndeavourOS, Manjaro, and Kubuntu.
UPDATE: I’ve written another post based on TLP.
This was helpful for me! Thank you!
Is there a way to make this persistent after reboots?
If I remember correctly, in the Arch wiki, you can find an example service that you can enable so that it does that automatically on every boot.
Lucas, I followed this guide: https://www.linode.com/docs/guides/start-service-at-boot/ to create a service. In the test_service.sh I just put the single command given in this article. Seems to work fine and is persistent after reboot!
Hey, it does not work with Ubuntu 24.04 as of 2024-11. Is there any updated guide?
I haven’t been using Ubuntu for some time…
Do you get any error in the log or something?