I noticed that battery life on linux in laptops sucks compared to windows. Windows used to give me 6 to 7 hours backup on light load. Linux hardly gets to 2 to 3 hours. Because windows dynamically adjusts the CPU frequency based on the work is going on the device. High frequency for higher load and low frequency for lower loads. Its not available in linux I guess. (I might be wrong). But there is a software that implements the thing in linux. I have seen significant battery life improvements after installing it. The software is auto-cpufreq. Its open-source.
To install it you can use the snap store.
sudo snap install auto-cpufreq
But fear not if you dont like snap(neither do i like snap).
You can clone the repo and install it. For that run the commands below. (This is the way I recommend)
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq && sudo ./auto-cpufreq-installer
If you encounter any problems during the installation , please submit a bug report.
after installing it, the
auto-cpufreq command will be available to you.
After that run this command
sudo auto-cpufreq --live to see how it works. Try plugging in and out your laptop. It will change the CPU governor based on the battery state. You might also see the turbo boost is also toggling between on and off.
There are still some work left. You have to install it as a system daemon so that it can start on startup. run this command to install the daemon
sudo auto-cpufreq --install.
Now its installed. Go ahead and restart your laptop. And now your battery life should improve. Run the command
auto-apufreq --stats to see the live stats.
But if you want to get more improvements you can disable turbo boost when your laptop is not charging. So it doesn't throttles your cpu when your battery is not charging. Go ahead and create this file
and paste the following in it
# settings for when connected to a power source [charger] # see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors # preferred governor. governor = performance # turbo boost setting. possible values: always, auto, never turbo = auto # settings for when using battery power [battery] # see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors # preferred governor governor = powersave # turbo boost setting. possible values: always, auto, never turbo = never
Restart again after doing it.
A note. The software will disable bluetooth because it takes a lot of battery life. It can be enabled again by using the rfkill command. And also the tool was meant to replace TLP. So its recommended to remove TLP.
I hope it helped you.