Linux battery life on laptops is known not to be great. Due to the need to test on so many types of hardware, it isn’t feasible for distros to be optimized for it out of the box. Here are my notes on what I’ve done to optimize Ubuntu battery life on my laptop, while some of the install commands will be specific to Ubuntu / Debian derived distros, the tips will work on any distro.
How to get better battery life on Ubuntu and Other Linux distros overview. Read the full article for details.
- Install Powertop to get a baseline
Powertop is a useful command line tool that will give you a baseline to measure improvements
- On Ubuntu, switch from Max Performance to Power Saving
This is pretty obvious, just flip the switch and let Ubuntu do it’s magic. Mostly this just caps your CPU, which will save a lot of battery life but will cause a noticeable slowdown
- Install and enable PowerTOP
PowerTOP is a very powerful and effective program to extend your battery life. PowerTop will make some common tweaks to reduce your wattage utilization.
- Install and configure TLP
Another great application for configuring common power saving configurations.
- Install and enable Slimbook Battery
Slimbook battery is a useful GUI program which I’ve had luck with greatly reducing my power utilization.
- Turn your screen brightness down
Another obvious tip, but it really does make a big difference.
- Ultimate way to get more battery life… buy an external battery
Okay okay, maybe this isn’t what you were looking for, but when I’m traveling I throw a good quality external battery. I get two full charges, which is certainly the best way to improve your battery life other than plugging into a wall outlet.
Getting a baseline for Ubuntu battery life
First thing to do is get a baseline measurement before doing any configuring. I’ve got a Thinkpad t480s with an intel core i7 8th gen.
To get a baseline measurement I’ve installed PowerTop
sudo apt install powertop
Run Powertop to start measuring your performance
After a restart, with only my web browser and a terminal for
powertop open to take notes, here are my measurements for each power setting:
- Performance: 23.0 W – 5.43 W
- Balanced: 18.1 W – 4.23 W
- Power Saver: 9.65 W – 4.39 W
After each setting change I let my laptop sit idle for a few minutes until the wattage evened out to get a low end reading. For the high end reading I opened VS Code, ran some containers, opened and closed multiple tabs in chrome, and opened GIMP. Something I would be doing in my typical usage.
The Ubuntu power settings use power-profiles-daemon, while doing many things the most effective control is capping CPU frequency. This will significantly reduce wattage usage but there are many more power savings which can be had.
I can notice significant performance degradation in Power Saver mode. The VS Code terminal actually has a noticeable delay in my typing.
Switching to balanced offered a very snappy and performant working environment. No complaints about this level of performance.
Okay, this is kind of cheating but the easiest thing you can do is order an external battery. I keep this one in my backpack and it gives me nearly 2 full charges.
Click here to see the Omni Mobile on Amazon. I get a commission if you purchase this. I really do recommend it.
Click below to checkout my article discussing portable laptop power banks for more info.
Optimize Ubuntu battery life with PowerTOP
Tune power settings once with PowerTOP.
sudo systemctl start powertop.service
In the PowerTop console tab to the Tunables tab and you should now see all options set to good.
Enable the PowerTOP service to startup on boot via SystemCTL and keep the power settings tuned.
systemctl enable powertop
More notes on PowerTOP from Red Hat: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/managing-power-consumption-with-powertop_monitoring-and-managing-system-status-and-performance
Optimize Ubuntu battery life with TLP
TLP is one of the most well known and best Linux tools for reducing energy consumption and increasing laptop battery life. TLP RDW (Radio Device Wizard) is especially critical for laptops. Once installed, TLP will mostly do the right thing out of the box without config needed, although we will go over configurations.
Install TLP and TLP RDW
sudo apt install tlp tlp-rdw
Configure TLP to save battery life
Configure TLP to start on boot and startup TLP
sudo systemctl enable tlp.service sudo tlp start
Cofirm TLP is installed and running
sudo tlp-stat -s
See the current TLP configuration
sudo tlp-stat -c
Display battery information with TLP
sudo tlp-stat -b
TLP configs are probably good for you out of the box, but we can get a lot better with a few tweaks. Without any more tweaks I saw a minor difference in idle wattage. The extra configs below made a big difference.
Checkout this link for more info on configuring TLP from the CLI
Edit the TLP config which is at
/etc/tlp.conf. Consider adding the following configurations
ENERGY_PERF_POLICY_ON_BAT=power CPU_HWP_ON_BAT=power PCIE_ASPM_ON_BAT=powersupersave
Idling with only a terminal open running powertop, with Slimbook battery and the Gnome power settings all set to their power saving modes, I hit 3.15 W with these configs.
Configure TLP via GUI
In the next section we will use Slimbook Battery, this is another GUI tool which will configure TLP for you
Slimbook Battery is a good GUI tool that can be used to configure TLP as well as other power setting.
Continue making tweaks to TLP
Make sure to tab through all the tabs in PowerTOP. The Overview tab and Device Stats will give you the crucial information to keep optimizing. Notice my screenshot below. Notice some devices have a lower % of power usage while many have 100%. Figuring out how to cut down that device % is how you are going to cut down your power consumption even further.
Optimize Ubuntu battery life with Slimbook Battery
Read about Slimbook Battery on their GitHub: https://github.com/Slimbook-Team/slimbookbattery
Slimbook Power integrates with applications, services, and drivers like TLP, intel_pstate, AMD and NVIDIA. Giving you some easy to pick configuration options just like the Ubuntu power saving settings which you can select from the gui.
Install Slimbook Battery
sudo add-apt-repository ppa:slimbook/slimbook sudo apt update sudo apt install slimbookbattery
Launch and configure Slimbook Battery
With Slimbook battery installed you can open it as you would any other app via the GUI
Set Slimbook battery to autostart and flip through the tabs to change configurations as you would like, it’s all pretty strait forward.
Slimbook is going to run in the background auto-tuning your power settings. This may be annoying for a while as it throws a pop up each time it changes a setting.
Post Optimization Measurements
With Slimbook Power and the Gnome power settings set to their minimum configurations, I was able to get down to 3.14 W. That’s about a 25% improvement.
Min: 3.14 W
Mid Settings: Typical development session power test
On Battery, as I did at the beginning, I tested my power consumption with a fairly typical set of tooling open. Several gnome-terminals, many Brave browser tabs open, VS Code open, several docker containers spinning up, and opening and closing GIMP to really hit the CPU.
Max: 9.48 W
This is a 52.3% reduction in power consumption!
Max Settings: Typical development session power test
On battery, with all performance settings tuned to high. I ran the same tests as above.
Max: 12.9 W
This is a 56% reduction in power consumption!
I’m very happy with these power reductions, that should lead to a doubling on the battery life for realistic usage.
Do You Have More Ideas?
If you’ve got more ideas for tuning battery life or want to comment something, please leave it in the comments. I’ll add good tips into the article and credit you.
2 thoughts on “Optimizing Ubuntu Battery Life for 50%+ battery life gains🔋”
Linux battery drain after shutdown workaround. Do this to stop battery drain when your Linux laptop is off.
Logout Not shutdown. Then press CTRL + ALT + F1
Enter your username and password.
Sudo init 0
( that is zero not an oh)
Enter your password and press enter.
Your laptop will now shutdown and the battery will not drain while laptop is off.
Thank you for the tip. For anyone interested here are some more details about init 0.