Battery usage on Linux may be a big problem for many users, depending on the distribution you use and the hardware you have, you may face this problem from time to time, and we have some solutions to help you through this.
But First, Why Battery Usage On Linux is So High?
You have to know that the primary reason for the huge battery drain on Linux is that hardware vendors don’t usually release the complete detailed documentation for the hardware they make on the public, which makes it very hard for Linux kernel developers to create drivers for it.
There are thousands of small components and chips in every single computer out there and each one of them needs a driver to work on any operating system. For Windows, this is not a problem since it holds more than 90% of the market (Hardware vendors will cooperate with Microsoft developers to provide documentation = no drivers problem = no battery usage problem). But for Linux, it’s not the same since it only holds around 2% of the desktop market-share.
If a hardware documentation is not is not available, kernel developers won’t be able to create a driver for it which means you won’t be able to use that hardware on Linux, if a hardware documentation is available poorly or not completely detailed, the power management for that piece of hardware won’t be good.
Kernel developers may choose to keep that piece of hardware or chip running all the time instead of using intelligent power on/off features based on the operating system needs (Because of lack of documentation from hardware vendors), which is what consuming the battery on Linux.
Now if you want to reduce the battery usage on Linux, follow those tips:
1- Install TLP
TLP is a power management program for the Linux desktop, it offers a lot of options and settings to turn on / off whatever hardware part you want in your PC. It’s free and open source as well. Its main feature is the advanced options and adjustments it provides to users. A complete power management system which is also doing its job directly after installation, TLP will start to use the default power-saving settings for your system.
To install it on Ubuntu:
sudo apt-get install tlp tlp-rdw
To install it on Fedora:
sudo dnf install tlp tlp-rdw
To install it on SUSE/openSUSE:
sudo zypper in tlp tlp-rdw
To enable using TLP at every boot automatically:
sudo systemctl enable tlp
Then restart the operating system in order to changes to take effect, there’s nothing additional to do now, TLP will do everything for you, it will use its default settings to try to save battery usage.
However; You can edit the file /etc/default/tlp if you want to change some of its settings. We recommend checking the official guide for TLP to do this step correctly.
To check the current status of the battery, you can use:
2- Disable Any Installed Screensavers
Screensavers are programs that work in the background to display some special graphics or information you request when the computer is not in use, it’s an old piece of software that is no longer needed – really – on desktop users’ laptops. They consume power as well, specially if they run heavy graphics themes or such things.
To disable the screensaver, run:
xset s off
But this will disable it for the current session only, to disable it at every boot, add it to the /home/user/.xsession file, replace user with your username, if the file doesn’t exist, create it:
And add the following line:
xset s off
3- Check Which Applications Use Power the Most
For this, you can use “powertop”, a small command line utility to measure applications and programs usage of power and resources, you can install it on any Linux distribution to know what is consuming your battery.
On Ubuntu, run the following command in the terminal:
sudo apt install powertop
sudo dnf install powertop
sudo zypper install powertop
Then to run the utility, run:
4- Use Lightweight Software and Interfaces
Using some desktop interfaces like XFCE, LXDE, LxQt or OpenBox may be a good decision if you want to save battery. Those interfaces are designed for hardware with limited resources actually and they consume very small part of it. Using those interfaces on your computer will save you a percentage of battery life. The less resources your PC uses on daily basis for the desktop environment and other software you have, the more power you’ll save.
Also, try to avoid the big heavy programs that are known to draw resources, like android studio (It needs 4-8 RAM to work well) or VirtualBox, try to find light alternatives for those software if you really need the functionality they provide.
Good Read: What are the components of a Linux Distribution?
5- Adjust Brightness Level
Screen brightness is one of the main hardware pieces that use battery energy a lot, if you want to save this energy, you have to change some settings for this.
For the screen, you have to adjust the brightness to the lowest level possible (actually it’s even better for your eyes, high level of brightness my damage your eyes by time), to do that, you can use any brightness indicator available on the desktop interface you use, for example on Cinnamon:
Or, you can use “xbacklight”, a small command line tool to adjust the brightness level. It is almost available in all Linux distributions official repositories by default. To install it on Ubuntu:
sudo apt install xbacklight
To install xbacklight on Fedora:
sudo dnf install xbacklight
To install xbacklight on SUSE/openSUSE:
sudo zypper install xbacklight
Now after installation, you can use the xbacklight command with the “-set” option to adjust the brightness level, you can choose the range from 0 to 100, for example to set the brightness on 10:
xbacklight -set 10
Make sure you add the previous command to the startup programs in order to save you the time to run the command each day.
6- Adjust CPU Settings and Modes
Using your CPU at its maximum power when not needed is not a good option, you know.
For the CPU, you can install “cpufrequtils”, which is a tool that allows you to control the frequency of the CPU at anytime you want, you can increase it when you need to run many programs and decrease it when you don’t need high frequency. You can also choose from the different modes that the tool offer.
To install on Ubuntu:
sudo apt install cpufrequtils
To install on Fedora:
sudo dnf install cpufrequtils
Now for the usage part.. If you want to get information about your current CPU, you can run:
If you want to set some specific frequency for the CPU, you will have to deal with the “cpufreq-set” tool, it has a lot of options and offers many modes that you can use by default when booting your laptop. For example to switch to the powersave mode, run:
sudo cpufreq-set -g powersave
And to use the performance mode:
sudo cpufreq-set -g performance
You can also choose to set the frequency to a specific speed if you want (Like 1500Mhz for CPU 2), to do this, refer to this answer.
Good Read: Linux Commands: Basics, Examples & Everything Important
7- Use a Different Kernel Version
Sometimes the kernel version you use may has a great impact on the battery life of your laptop, some drivers may be added, some my be removed or enhanced, so trying different versions of the kernel will be an option worth to try.
A friend of mine had a problem with the laptop fan (it didn’t work) on Ubuntu, he tried all the possible solutions and failed, finally, he tried to build the kernel from source on Ubuntu and after he done that, it worked. Ubuntu – for example – is using some special patches that are not coming from the upstream, they also use different configuration when building the kernel, so some hardware may not be compatible with that.
You can check your distribution official repositories for newer versions of the Linux kernel, for Ubuntu-based distributions you can download packaged kernels from the “Ubuntu Kernel Mainline” project (Those images are vanilla, so don’t worry), just check the folders and choose what version you want to test and download the packages (3 packages for each version, the headers, the generic headers and the image) and install them, reboot to see the new kernel.
For other distributions you can consider building the kernel from the source, download the latest version from Kernel.org and check the README file for build and installation instructions.
There are lots of options and solutions to consider if you are facing the power consumption problem on Linux, trying those tips may be good for you if you want to solve this problem.
Do you use any other software or solutions to solve this issue? What are they?
Hanny is a computer science & engineering graduate with a master degree, and an open source software developer. He has created a lot of open source programs over the years, and maintains separate online platforms for promoting open source in his local communities.
Hanny is the founder of FOSS Post.
This is great article. After reading it, I am inspired not to use hardware with proprietary drivers any more.
Now I am facing this question: Which computer manufacturers use hardware with publicly known drivers?
I am a new owner of a Lenovo Thinkpad T14 and everything just owrked out of the box on opensource drivers with OpenSuse 15.2. I recently heard that Lenovo is going to be relaeasing all drivers for all its sytems fro Linux from now on.
Excellent article, I am running Xubuntu 22.04 (ubuntu w xfce) on a 2015 Macbook Pro, everything is working but battery life was around 2.5 hrs only
after following these steps, powertop shows my battery life improved to 4.5 hrs, not amazing but very decent considering its apple hardware
if anyone needs an ubuntu bootstrap script, heres my gist that has many of these steps scripted in bash