Improving battery life time in Linux

Today I received a new battery for my Dell Latitude E6400 laptop. The old battery (a 6 cell one) only lasted for about 15 minutes any more, 1,5 year after I acquired this system. The new battery is a 9 cell version. gnome-power-manager estimates I should be able to run 6 hours now without a charge, which corresponds with what I expected.

Now that I have a new battery, it is time to take a look again at trying to lower power consumption as much as possible. On my system I am using Mandriva 2010.1 Cooker with GNOME 2.30 and laptop-mode-tools 1.54, but this howto should apply (sometimes with slight modifications) to other distributions too.

Setting up ondemand cpufreq governor

The first thing to check is whether CPU frequency scaling is enabled. This should be supported on most up to date CPUs, including Intel Pentium M and Intel Core series and all AMD Athlon 64 and Turion CPUs.

Install the cpufrequtils package:

# urpmi cpufrequtils

Now run the cpufreq-info command to see the current cpufreq settings of your processors. It should show the different clock frequencies supported by your processors and which cpufreq governor and which frequency is currently active. Even when not running on battery power, the “ondemand” cpufreq governor should be used so that it will use the lowest frequency when your system is mostly idle and will switch to the fastest frequency when your system gets loaded. To configure the ondemand governor by default, you can install the cpufreq package with urpmi. It will load the governor set in /etc/sysconfig/cpufreq at boot up, which is ondemand by default.

If cpufreq-info complains that no cpufreq driver is loaded, you can try to run

# modprobe acpi-cpufreq

if you have an Intel CPU or

# modprobe powernow-k8

if you have an AMD CPU and retry. These are the most widely used cpufreq drivers. If one of these is successful and it was not loaded automatically, you can add the right driver name to the /etc/modprobe.preload file so that it gets loaded automatically at the next boot.

Setting up gnome-power-manager

In GNOME open the menu System and then choose Preferences – Power Management.

You can already set up some power savings measures in the AC Power tab. Personally I have it set to go to sleep after 1 hour, to blank the screen when the laptop lid is closed and to put the display to sleep after 5 minutes of inactivity. I have set the display brightness to 100% and disabled dimming on idle.

In the Battery Power tab I have configured to go to sleep when inactive for 10 minutes and to blank the screen when the lid is closed. When battery power is critically low I let it hibernate (so that no data is lost when the battery runs out completely) and I let the hard drives spin down. The display goes to sleep after 1 minute of activity and the display is dimmed when idle.

If you have root access on your laptop, I recommend clicking on the Make Default button, so that it will use these settings for all users and also when you are not logged in yet.

Now there are some more advanced settings which are not shown in gnome-power-manager’s preferences utility. Start up gconf-editor (System – Preferences – Configuration Editor) and navigate to /apps/gnome-power-manager in the tree of the left side. Under that folder you will find the subfolder backlight. Select it to see more detailed settings at the right side. There I have set the brightness_dim_battery key to 80 for a still lower brightness when running on battery power. You will see the effects of changing the value immediately when you are running on battery, so you can try out different values to find what suites you best. The idle_brightness key (the brightness to be used when idle) is set to 20 and idle_dim_time (amount of seconds after which the screen backlight will be dimmed) to 15.


Make sure you have the laptop-mode-tools package installed. This tool will automatically implement all kinds of power saving settings when you system switches to battery power.

Open the file /etc/laptop-mode/laptop-mode.conf in a text editor as root. Only a few settings need to be tweaked.

To enable most power saving modules, set


When running on battery power, it is recommended to make sure all file systems are mounted with the noatime option, in order not to cause any writes every time a file is read. Set


Laptop-mode-tools also controls the hard disk idle timeout. I set it to the same values as gnome-power-manager so that they will not override each other:


The various laptop-mode-tools are configured in the files in /etc/laptop-mode-tools/conf.d. Again the defaults are pretty nice. I made these changes:

  • I do not use Bluetooth very often and when I use it, I am always on AC power. So to save battery time I ldisable Bluetooth when running on battery power. In /etc/laptop-mode-tools/conf.d/bluetooth.conf, set

  • Thanks to the cpufreq package, we already set up the ondemand cpufreq governor. However when running on battery it is even better to run the conservative governor: instead of going to full speed when the machine gets loaded, the conservative governor will more gradually switch to the frequencies between the minimum and maximum frequencies. In /etc/laptop-mode-tools/conf.d/cpufreq.conf set

  • In the file /etc/laptop-mode-tools/hal-polling.conf, HAL polling is disabled by default when running on battery. If you do not want this (it might prevent automounting of CD and DVD media when running on battery power, set


    However, if you want to enable this, check that your CD/DVD drive is mentioned the polling devices configured in that file. By default it will disable polling on all /dev/scd? devices but on my system the DVD drive is called /dev/sr0, so I modified it to /dev/sr?. Unfortunately, laptop-module-tools does not yet support udisks-daemon, a replacement for HAL which also polls the CD/DVD drive.

Laptop-mode-tools can also disable certain services when running on battery power. This is interesting for scheduling daemons like crond and atd.

cd /etc/laptop-mode/batt-stop
ln -s /etc/init.d/atd .
ln -s /etc/init.d/crond .

After changing the laptop-mode-tools configuration, restart the service:

# /etc/init.d/laptop-mode-tools restart

Enabling caching in rsyslog

In order to prevent too much disk wake-ups because of logging it is recommended to enable caching for all log files in rsyslog. Edit /etc/syslog.conf and make sure there is a – before every /var/log file name. Then restart rsyslog:

# /etc/init.d/rsyslog restart

Run powertop to identify applications causing too many wake-ups

Install the powertop package and run powertop as root. After it has collected enough data it will show the processes causing the most CPU wake-ups. Stop any unneeded applications causing lots of wake-ups. Powertop will also give you power saving recommendations but you can actually ignore them: if you have set up laptop-mode-tools as explained above, all of them are implemented already.

Disable WiFi if you do not use it

And last but not least: switch off your wireless network card with the wifi kill switch on your laptop if you do not use it. This simple trick can easily give you more than 10% more battery life time. You can also disable it when you temporarily do not need the network connection, for example while reading long web pages or while writing e-mails.

With all these measures in place and with a bit of conservative wifi usage, it seems my battery will last more than 7 hours. That is a nice improvement!