you're reading...


Powersaving on Linux Laptops

I’ve been a long time Linux fan and user. I have been subscribed to each new software update and eager to install and test the updates. Everything was going fine until a kernel update brought me the very famous Linux Power Regression. Since that day, I’ve been fighting out to save some juice on my Dell XPS 14z laptop. Despite a 8-cell prismatic battery, the average battery backup time is 1 hour. I tried a lot of solutions but none of them seemed to work, every solution had a downside. The only option seemed to patch the Kernel source (provided by Mathew Garett), build a custom kernel with the patch, and use the patched Kernel. But soon enough I discovered that there is no single regression and there were other regression out there that needs to be fixed. As of now, there are some promises with the upcoming 3.11 version of the Kernel, but that too is not going to be a final solution.

As of now, I’m using small tweaks to try to save some battery life (with some negative performance impact though). This tweaks do not generally address the power regression in the Kernel, but are generic enough to save you some watts on battery usage. Below are the tweaks that I’ve used with my laptop:

PowerTop fixes

PowerTop is a software utility designed to measure, explain and minimise a computer’s electrical power consumption. It was released by Intel in 2007 under the GPLv2 license. It works for Intel, AMD, ARM and UltraSPARC processors. It’ll point out the current power usage, and also gives suggestion on what system parameters can you tweak to save more power. Unfortunately, and tweakings done through PowerTop CLI interface is lost on reboot. Follow these steps to properly run powertop and use its suggestion for a permanent fix for less power usage (changes will persist after reboot).

  • Install PowerTop
sudo yum -y install powertop
  • Ensure that your laptop has at least 15 minutes of power backup to run powertop.
  • Disconnect charging from the laptop.
  • Run powertop in calibrate mode. Your screen will flickr several times during calibration:
sudo powertop --calibrate
  • Run powertop again to see suggestions (tunables):
sudo powertop --html
  • The previous step will create a file powertop.html in the current directory. Open the html file in your favourite browser.
xdg-open powertop.html
  • Click on the Tunables link. The resultant page/frame will list you all the parameters in the systems that can be tweaked to save battery. It’ll also give you commands for each tweak. Copy all the tweak commands.
  • Create rc.local file so that we can put our tweak commands there, so as they are run every time the computer starts up.
sudo vi /etc/rc.d/rc.local
  • Paste all the copied tweak commands in vi screen and save the file.
  • Now add executable bit to the rc.local file.
chmod a+x /etc/rc.d/rc.local
  •  Run powertop again, go to the Tunables section (press [TAB] key).
sudo powertop
  • Now all the tunables should be reported as good.

Tuned Fixes

Tuned is a daemon that uses udev to monitor connected devices and statically and dynamically tunes systemd settings according to a selected profile. Follow these steps to install and setup Tuned to extend battery backup:

  • Install tuned and additional profiles.
sudo yum -y install tuned tuned-utils tuned-utils-systemtap tuned-utils-systemtap hdparm
  • Enable Tuned daemon on startup
sudo systemctl enable tuned.service
  • Start Tuned daemon
sudo systemctl start tuned.service
  • Enable the laptop-battery-powersave profile for Tuned
tuned-adm profile laptop-battery-powersave
  • Reboot your laptop.
  • Check the current tuned profile.
tuned-adm active
  • In the previous command, the output should be laptop-battery-powersave.

Bumbleebee for NVIDIA Optimus

Bumblebee is a project aiming to support NVIDIA Optimus technology for laptop having discrete graphics cards. These steps are only for laptops having NVIDIA optimus. To check if you have discrete graphics card on your latop:

lspci | grep VGA

The output should be like:

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GF119M [GeForce GT 520M] (rev ff)

Follow these steps to install bumblebee:

  • Fully update the system.
sudo yum -y update
  • Install Bumblebee (on Fedora 19):
yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora19/noarch/bumblebee-release-1.1-1.noarch.rpm
sudo yum -y install install -y libbsd-devel libbsd glibc-devel libX11-devel help2man autoconf git tar glib2 glib2-devel kernel-devel kernel-headers automake gcc gtk2-devel VirtualGL dkms
sudo yum -y install bbswitch bumblebee
  • Install Nvidia proprietary drivers (on Fedora 19):
sudo yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora19/noarch/bumblebee-nonfree-release-1.0-1.noarch.rpm
sudo yum -y install glibc-devel
sudo yum -y install bumblebee-nvidia
  • Install Primus for speed improvements:
sudo yum -y install primus
  • Test bumblebee:
optirun -b primus glxgears -info
  • Use optirun while running memory and GPU intensive applications like games. Use the following format:
optirun -b primus <application>

Further Reading


No comments yet.

Post a Comment