Ajitesh Madai's Blog

Increase Laptop battery life on Ubuntu/Linux using PowerTOP

Leave a comment

PowerTOP is a great utility which allows you to diagnose power consumption on Linux machine.It provides with lots of stats mentioning power consumption per process, per processor, per device, idle states of each core etc.

Heres a guide on how to use powerTOP to increase battery life on Ubuntu or Linux installed laptops…

PowerTOP Command Line

PowerTOP Command Line

Apart from the stats, the section I find more interesting is “Tunables” which provides with lot of tuning options, enabling them can save power and extend your laptops battery life.

To begin with we have to install PowerTOP. This can be done by installing it from your favorite Linux distribution repository. But as Ubuntu 14.04 contained an older version of PowerTOP, I decided to go with a compile installation of the latest and the greatest version.

So, first we need to download the latest sources from here : https://01.org/powertop/downloads

Then, extract the sources and go to that location via Terminal prompt.

Before compilation, I had to install some dependencies. This dependencies may change according to the version of Ubuntu or PowerTOP and if any are missing then they are prompted whenever you configure the build.

For Ubuntu 14.04, I had to install the following:

sudo apt-get install libncurses5-dev libnl-dev libpci-dev

Then we need to compile them using the following coomands :

sudo ./configure
sudo make
sudo make install

After successful installation, you need to to continue with following:

sudo powertop -- calibrate

This will run you laptop through a series of tests. It will cycle your display through varying levels of brightness,turn on and off various devices. Please do not touch your laptop during this time, leave it aside until the calibration completes. It wont take long.

After this you need to fire the following command :

PowerTOP Tuning Report

sudo powertop --auto-tune

This will auto-tune all of the “Tunables” to “Good” setting. But the changes it makes is not permanent but only till current user session. So lets reboot our machine to determines which settings have stuck and which haven’t.

After reboot fire up the teminal with the following command :

sudo powertop --html

PowerTOP Tuning Report

PowerTOP Tuning Report

This will generate an html report of the findings made by powerTOP. Open the html in a browser and move to “Tuning” sections, and under “Software Settings in Need of Tuning” copy the commands there along with the description.

Paste all these commands in rc.local file and comment out their description in case you need to know in future why it was added here.

sudo gedit /etc/rc.local

PowerTOP Tuning Commands added in rc.local file

PowerTOP Tuning Commands added in rc.local file

This will run all these commands at startup and ensure all power tuning settings are in “Good” state on every reboot.

Happy Power Saving !! 🙂

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s