Monday, July 15, 2013

[How to] Improve Battery Life in Linux

How to improve battery performance in Linux



If you want to improve your battery life in Linux and you want to replace Jupiter because it is no longer maintained, you can check out TLP.

In this post I will show you some features of TLP and how to install it in different distros.

Note: I only have two computers, one with Ubuntu and another with Fedora. I haven't try this in openSUSE.

TLP features


"TLP is a pure command line tool with automated background tasks". So be prepare to launch a Terminal.

Here are the features showed in the TLP official site:

Settings depending on the Power Source
  • Kernel laptop mode and dirty buffer timeouts
  • Processor frequency scaling including "turbo boost" / "turbo core"
  • Power aware process scheduler for multi-core/hyper-threading
  • Hard disk advanced power magement level and spin down timeout (per disk)
  • SATA aggressive link power management (ALPM)
  • PCI Express active state power management (PCIe ASPM) – Linux 2.6.35 and above
  • Runtime power management for PCI(e) bus devices – Linux 2.6.35 and above
  • Radeon KMS power management – Linux 2.6.35 and above, not fglrx
  • Wifi power saving mode – depending on kernel/driver
  • Power off optical drive in drive bay (on battery)
Additional functions
  • I/O scheduler (per disk)
  • USB autosuspend with blacklist
  • Audio power saving mode – hda_intel, ac97
  • Enable or disable integrated wifi, bluetooth or wwan devices upon system startup and shutdown
  • Restore radio device state on system startup (from previous shutdown).
  • Radio device wizard: switch radios upon network connect/disconnect and dock/undock
  • Disable Wake On LAN
  • WWAN state is restored after suspend/hibernate
  • Untervolting of Intel processors – requires kernel with PHC-Patch
  • Battery charge thresholds – ThinkPads only
  • Recalibrate battery – ThinkPads only


Installing TLP


Now the serious part. If you want to use TLP you need to erase all kind of power configuration you may have done or scripts you may have implement.

In Ubuntu

Just add the official PPA:

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw

If you use a Thinkpad

sudo apt-get install tp-smapi-dkms acpi-call-tool

In Fedora

sudo yum localinstall --nogpgcheck http://repo.linrunner.de/fedora/tlp/repos/releases/tlp-release-1.0-0.noarch.rpm

sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
Install the following packages:
  • tlp (TLP repo) – Power saving
  • tlp-rdw (TLP repo) – optional, Radio Device Wizard
  • akmod-tp_smapi (TLP repo) – optional ThinkPad only, tp-smapi is needed for battery charge thresholds and ThinkPad specific status output of tlp-stat
  • akmod-acpi_call (TLP repo) – optional ThinkPad only, acpi-call is needed for battery charge thresholds on Sandy Bridge and newer models (X220/T420, X230/T430 et al.)
Install the above packages with the following command:

sudo yum -y install tlp tlp-rdw 
ThinkPads require an additional:

sudo yum -y install akmod-tp_smapi akmod-acpi_call

In OpenSUSE 12.3



zypper ar -f http://download.opensuse.org/repositories/home:/cdersch:/TLP/openSUSE_12.3/home:cdersch:TLP.repo 
In case the contrib repo is not yet active:

zypper ar -f http://download.opensuse.org/repositories/openSUSE:/Factory:/Contrib/openSUSE_12.3/openSUSE:Factory:Contrib.repo

Checking if TLP is running


If you want to manually start tlp run the command

sudo tlp start



You can check if tlp is enabled at any moment with

sudo tlp stat

If you want to be more specific

sudo tlp stat | grep "TLP_ENABLE"


or you can check

sudo tlp stat | grep "TLP power save"


Did you like this post? Don't forget to add me to your circles in G+ or to follow me on Twitter: @RobertoXMed .

If you can and if you want, don't forget to Donate so I can keep up the good work.

No comments:

Post a Comment