How To Improve Laptop Battery Performance In Linux
I use Arch linux as my primary distribution in my Laptop for day to day use. The one big problem I noticed while using Arch Linux is the poor battery performance. Since Arch Linux is rolling-release and DIY distro, I realized that Arch Linux doesn’t has any power saving utilities by default. I thought some bugs in Arch Linux drains my battery and leads to poor battery backup. How absurd, I am! Well, if you’re having the same issue, no problem. In this tutorial, I will show you how to setup two most used power management tools called Laptop Mode Tools and Powertop to improve battery performance Linux. These utilities are not just designed for Arch Linux, but for all Linux distros. If you’re facing any serious troubles with battery, you need to make sure you have setup power management right in your Laptop.
Laptop Mode Tools
Laptop Mode Tools, or LMT in short, is a power saving tool for Laptops/Notebooks installed with Linux. It extends the battery life of your Laptop, in several ways. It enables the Laptop Mode feature of the Linux kernel, which lets your hard drive spin down. And also, laptop Mode Tools allows us to tweak a number of other power-related settings for different hardware devices using a simple configuration file. It is a cross-platform power saving utility, thus It will work on almost all modern Unix-like operating systems, such as Arch Linux, Red Hat, Fedora, CentOS, Debian, Ubuntu etc.
Make sure you have removed any previously installed power saving utilities like TLP or anything else. Laptop Mode Tools is available in the default repositories of some Linux distributions. So, you can install it using the default package manager.
yaourt -S laptop-mode-tools
packer -S laptop-mode-tools
On Debian, Ubuntu, run:
sudo apt-get install laptop-mode-tools
In case, your distribution doesn’t has laptop-mode-tools in the repositories, you can download the source from here and compile and install it manually.
To do so, git clone the laptop-mode-tools repository using command:
git clone https://github.com/rickysarraf/laptop-mode-tools.git
The above command will clone the laptop-mode-tools repository in a directory called “laptop-mode-tools” in the current working directory.
Go to the laptop-mode-tools directory:
Then, run the following command to install it.
There are two configuration files. /etc/laptop-mode/laptop-mode.conf is the primary configuration file, and /etc/laptop-mode/conf.d/* directory contains dozens of feature-specific modules.
First, we need to enable laptop mode in our Laptop.
To do so, create/edit ‘/etc/default/acpi-support’ file:
sudo vi /etc/default/acpi-support
Add the following line.
Save and close the file.
Next, edit main configuration file /etc/laptop-mode/laptop-mode.conf:
sudo vi /etc/laptop-mode/laptop-mode.conf
Find the following line:
Set it value as 1.
And also make sure the value of ENABLE_LAPTOP_MODE_ON_BATTERY option is set to 1.
Save and close the file.
Enable and start LMT service:
sudo systemctl enable laptop-mode
sudo systemctl start laptop-mode
That’s it. Now, run the following command to verify if laptop-mode-tools is enabled ot not.
Sample output would be:
If you got the output as 2, good. LMT is enabled and working! If the output is 0(zero), LMT is not enabled. Reboot the system and check again. Also make sure that you have removed all other power management tools like TLP.
Also, you can individually enable or disable other hardware modules. These modules can found in /etc/laptop-mode/conf.d/ directory. To view the list of all modules, run:
Sample output would be:
ac97-powersave.conf kbd-backlight.conf auto-hibernate.conf lcd-brightness.conf battery-level-polling.conf nmi-watchdog.conf bluetooth.conf pcie-aspm.conf configuration-file-control.conf radeon-dpm.conf cpufreq.conf runtime-pm.conf cpuhotplug.conf sched-mc-power-savings.conf dpms-standby.conf sched-smt-power-savings.conf eee-superhe.conf start-stop-programs.conf ethernet.conf terminal-blanking.conf exec-commands.conf vgaswitcheroo.conf hal-polling.conf video-out.conf intel-hda-powersave.conf wireless-ipw-power.conf intel_pstate.conf wireless-iwl-power.conf intel-sata-powermgmt.conf wireless-power.conf
Each module can be enabled, disabled, or set to auto by changing the CONTROL_* argument of the respective config file in conf.d/ direcotry. LMT will attempt enable any modules where CONTROL_* is set to auto if ENABLE_AUTO_MODULES is set in /etc/laptop-mode/laptop-mode.conf file.
To check the list of modules which are enabled, disabled or set as auto, just run:
grep -r '^\(CONTROL\|ENABLE\)_' /etc/laptop-mode/conf.d
If you find an important module is disabled, you can enable it by editing the respective module file.
Just in case, you don’t like Laptop Mode Tools, you can give Powertop a try. Powertop is a Linux power management tool designed by INTEL open source community. This tool can be used to investigate the power consumption issues of various hardware devices in your system.
It is available in the default repositories of some Linux distributions.
In Arch Linux and its derivatives like Antergos, Manjaro Linux, Powertop can be installed using pacman as shown below.
sudo pacman -S powertop
On Debian, Ubuntu, Linux Mint:
sudo apt-get install powertop
On RPM based distributions like Fedora, run the following command to install it.
sudo dnf install powertop
After installing, enable and start powertop service using commands:
sudo systemctl enable powertop
sudo systemctl start powertop
Once installed, run it as sudo user like below.
When launching powertop without arguments, It starts in interactive mode.
The default interface of Powertop should look like below.
The utility has various sections. You can switch between them using the Tab and Shift+Tab keys. You can find all shortcut keys at the bottom of the Powertop interface. To quit this utility, just hit the Esc key.
As you see in Powertop interface, it lists the power usage of various hardware components. In addition, it also displays how many times the hardware components wakes up each second. So, if you want to improve the battery usage, you can reduce the wake up time of each devices.
To do this go to Tunables section.
Here, Bad indicates that particular hardware is not saving power. And, “Good” indicates a power saving setting is in effect. To change between the values, just press ENTER key on any tunable.
Just pass “–auto-tune” argument with powertop command if you want to set all tunable options to their good setting without interaction.
sudo powertop --auto-tune
You can even generate a report in CSV or HTML format for data analysis.
To generate CSV report, run:
sudo powertop --csv=powertop.txt
Loaded 0 prior measurements Preparing to take measurements Taking 1 measurement(s) for a duration of 20 second(s) each. PowerTOP outputing using base filename powertop.txt
You can view the csv report using any text editor.
To generate HTML report, run the following command instead.
sudo powertop --html=powertop.html
You can view the newly generated report in your web browser.
For more details, refer the man pages.
A note of caution: Be mindful that just use any one of the power management tools. If you use multiple power saving tools at a time, you may not get the proper or no result at all.
Additional tips to reduce Laptop overheating:
Make sure your room where you use your Laptop has proper air ventilation. Do not use it in a room with no or less air circulation. Buy and use any quality USB powered cooling pad. Power off your Laptop if you don’t use it. I have had a bad habit of leaving my Laptop powered on all day. Don’t do that. If you don’t use, shut it down. Get your Laptop cleaned from time to time, at least 3 months once. More importantly, keep your Laptop out of sun, fire or any other hot places.
And, that’s all. I will be soon here with another useful. If you find this guide useful, please share it on your social networks and support OSTechNix.
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!