Improving battery health when running Proxmox VE on a laptop

davidand

Well-Known Member
Feb 17, 2020
108
25
58
45
I'm running a Proxmox VE on a laptop computer and because it's always on 24/7 I'd like to make sure the battery lasts long.

I figured our that Linux OS has a built in support for limiting battery threshold simply by: (for example to 80%)

Code:
cat 80 > /sys/class/power_supply/BAT0/charge_stop_threshold

My issue is, though, that this file does not exist on my laptop running Proxmox VE. (It does exist on another laptop running pure Debian)

These are my files under /sys/class/power_supply/BAT0/:

Code:
root@proxmox:/sys/class/power_supply/BAT0# ls -l
total 0
-rw-r--r-- 1 root root 4096 Sep 29 18:09 alarm
-r--r--r-- 1 root root 4096 Sep 29 18:09 capacity
-r--r--r-- 1 root root 4096 Sep 29 18:09 capacity_level
-r--r--r-- 1 root root 4096 Sep 29 18:09 charge_full
-r--r--r-- 1 root root 4096 Sep 29 18:09 charge_full_design
-r--r--r-- 1 root root 4096 Sep 29 18:09 charge_now
-r--r--r-- 1 root root 4096 Sep 29 18:09 current_now
-r--r--r-- 1 root root 4096 Sep 29 18:09 cycle_count
lrwxrwxrwx 1 root root    0 Sep 29 18:09 device -> ../../../PNP0C0A:00
drwxr-xr-x 3 root root    0 Sep 29 18:09 hwmon2
-r--r--r-- 1 root root 4096 Sep 29 18:09 manufacturer
-r--r--r-- 1 root root 4096 Sep 29 18:09 model_name
drwxr-xr-x 2 root root    0 Sep 29 18:09 power
-r--r--r-- 1 root root 4096 Sep 29 18:09 present
-r--r--r-- 1 root root 4096 Sep 29 18:09 serial_number
-r--r--r-- 1 root root 4096 Sep 29 18:09 status
lrwxrwxrwx 1 root root    0 Sep 29 18:09 subsystem -> ../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Sep 29 18:09 technology
-r--r--r-- 1 root root 4096 Sep 29 18:09 type
-rw-r--r-- 1 root root 4096 Sep 29 18:09 uevent
-r--r--r-- 1 root root 4096 Sep 29 18:09 voltage_min_design
-r--r--r-- 1 root root 4096 Sep 29 18:09 voltage_now

Anyone has had luck with making this work?
 
Hi!
Checking out the kernel source code it seems that control file is only defined by the thinkpad_acpi module, so is that laptop a thinkpad model or at least compatible to that module (not sure if there are any non-thinkpad models that are)?
 
You may be able to do that with TLP https://linrunner.de/tlp/

The very recent released version 1.4 mentions the following:
- Extended charge threshold support for laptops with a suitable kernel driver: ASUS, Huawei, LG, Lenovo (non-ThinkPad series), Samsung
-- https://linrunner.de/tlp/news.html#tlp-1-4-released

But, that package is not yet available in most distros and Proxmox VE 7 (which bases of Debian 11 Bullseye) may only get it via backports. I checked the Debian package tracker for TLP ( https://tracker.debian.org/pkg/tlp ) and it seems that 1.4 is already in unstable, so you may get lucky with a backport to try soon(ish).

FYI, the arch wiki has some basic but good info for using TLP https://wiki.archlinux.org/title/TLP maybe that can help now already.