Battery life is very dear to laptop users and thus we need to take a look at proactive ways to reduce power usage. This will involve profiling what is causing battery usage (screen, hdd hits, etc.) and working to reduce them.


We want to increase usage of Ubuntu on laptops and help those existing users by making their experience better.

Use cases

  • Jane is travelling on a plane from Cape Town to London and would like to be able to work on her document for as long as possible. With two batteries, she can almost make the entire flight, but not quite.
  • Alan works in the field and can only charge his laptop from generator, which only runs at night. During the day he works off a car battery, charged at night from the generator. He would like to be able to last the whole day on a single car battery.


  • Any package in the default install which can cause excessive battery usage, such as accessing the harddrive, etc.


  • Profile a current install of Ubuntu to figure out what is using the battery
  • Tweak each program in turn to reduce power usage
  • Analyse disk profiles to set appropriate hdparm settings
  • PCMCIA deactivation


*powertop* is a very good way to point out a lot of power draining programs.


acpi scripts


# Tweak virtual memory for running on AC.

echo 60 > /proc/sys/vm/swappiness
echo 3000 > /proc/sys/vm/dirty_expire_centisecs
echo 500  > /proc/sys/vm/dirty_writeback_centisecs
echo 10   > /proc/sys/vm/dirty_background_ratio
echo 40   > /proc/sys/vm/dirty_ratio


# Tweak virtual memory to conserve power when running on batteries.

echo 10 > /proc/sys/vm/swappiness
echo 0 > /proc/sys/vm/dirty_expire_centisecs
echo 0 > /proc/sys/vm/dirty_writeback_centisecs
echo 60 > /proc/sys/vm/dirty_background_ratio
echo 95 > /proc/sys/vm/dirty_ratio

(on feisty, something else is setting dirty_expire_centisecs/dirty_writeback_centisecs/dirty_background_ratio)


# Change the wireless power mode to AC.
#   This should work for most chipsets

for x in $(/bin/ls -d /sys/class/net/*/wireless | /usr/bin/cut -d'/' -f5); do
    /sbin/iwconfig $x power off
    /sbin/iwpriv $x set_power 6


# Change the wireless power mode to Battery.

for x in $(/bin/ls -d /sys/class/net/*/wireless | /usr/bin/cut -d'/' -f5); do
    /sbin/iwconfig $x power on power period 2 power timeout 300u
    /sbin/iwpriv eth1 set_power 7

video card low power mode

DavidP8 - For the open source ATI/radeon driver there is the xorg.conf driver option:

        Option          "DynamicClocks"         "on"

The following is a nasty hack for the fglrx driver. It sets the video card to low power mode on boot.

The need for this hack points to the usefulness there would be of an acpi event generated upon user login/display activation. (perhaps this event already exists). The event could then trigger an acpi script which sets the video card to low power mode.

Data preservation and migration



Where does laptop_mode fit into this ? - TormodVolden

Reducing battery usage should really be addressed ASAP, but is not that easy: there are already some bugs filled against Ubuntu, acpi-support, powernowd stating battery life is reduced on Ubuntu (for me too). The sources of power consumption need a better testing scheme, so more information can be gathered. - NikolausFilus

I don't see where scaling fits in here? - MrProper2

In the current release '7.04' there does not seem to be an easy way to configure cpu scaling. The only way i found to do cpu scaling properly is to write a script to see if the ac adapter is plugged in?: if [ -z "grep 'off-line' /proc/acpi/ac_adapter/AC0/state" ] I currently put that in a script and set my cpufreq governors based on the AC state and symlink it into /etc/acpi/*.d/

This gives a much better battery life (somewhere around the 50% more mark on a core 2 duo)

NicolòChieffo: Please take care of these patches by Intel too!!! #patches-by-intel

DavidP8 - The following are the scripts I use for CPU freq management (very noticeable battery life extension):

  • MartijnVanDeStreek: Gnome Power Manager already handles CPU scaling governors while on battery.

# Set CPU scaling / max freq to AC mode

for x in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
    echo "ondemand" > $x
    awk '{print $1}' $X/scaling_available_frequencies > $X/scaling_max_freq

# Set CPU scaling / max freq to battery mode

for x in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
    echo "conservative" > $x
    # The second column is the second from the highest freq most power savings / least slowdown
    awk '{print $2}' $X/scaling_available_frequencies > $X/scaling_max_freq

Outstanding issues

See also


ReducedPowerUsage (last edited 2008-08-06 16:13:43 by localhost)