Power saving in Linux

While you are on the road battery power is very valuable, and you probably want you battery to last as long as possible. On this page I describe a couple of tweaks with which you can conserve some power.

For more information:

[ Top | Bottom ]

Hard drive power saving

laptop_mode

The 2.6.x kernel series (>=2.6.6) contains a special feature, which purpose is to prolong battery life on laptops. To enabled it extract the "control script" from /usr/src/linux/Documentation/laptop-mode.txt, chmod it as executable, and run it as root: laptop_mode start
This works for all machines running a newer 2.6.x kernel

For more information:

  • Homepage for laptop mode
  • Read /usr/src/linux/Documentation/laptop-mode.txt for more info
[ Top | Bottom ]

Monitor power saving

DPMS (Display Power Management Signaling) makes it possible to power down a monitor. There are 4 states, a DPMS capable monitor, can enter: "standby", "suspend", "off" or "on". These states can be entered after a given amount of time, by entering the following information into your X configuration file:
Section "Monitor"
	...
	Option "DPMS"
	Option "StandbyTime"	"time"
	Option "SuspendTime"	"time"
	Option "OffTime"	"time"
	...
EndSection
Code listing 3.1
Where "time" is in minutes.

You can also enter a power saving state by using xset dpms force "state", where "state" is either: "standby", "suspend", "off" or "on".

[ Top | Bottom ]

Battery monitors

asapm is an applet that uses APM to display battery status, so either pmud has to fake APM support for it to work, or you use a 2.4/2.6 kernel with APM emulation. To get pmud to fake APM create the following pipe: mknod /etc/power/apm p Change ~/.asapmrc to:
device /etc/power/apm
Code listing 4.1
Start pmud with the -a option. This is done by adding it to the pmud configuration file /etc/sysconfig/power (ydl):
PMUD_FLAGS=-a
Code listing 4.2
To monitor the powerlevel of the battery in the gnome-panel, use APM emulation (see above) and add the gnome battery applet to the panel.

For more information:

[ Top | Bottom ]

Power saving on Apple's Powerbooks

pbbuttonsd and utilities

pbbuttonsd is a daemon that not only provides power saving functionality, but also monitors the Powerbook's volume/brightness buttons, and if they are pressed, adjusts the volume/brightness accordingly. GTKPBButtons is a supplement to pbbuttonsd, which pops up a window displaying the current volume/brightness settings. Powerprefs is the third piece of power saving on Powerbooks, and it allows you to control the touchpad and volume/brightness and sleep settings via a GUI.

For more information:

pmud

pmud is an older power saving daemon, I would suggest that you use pbbuttonsd instead.

To pass options to it on startup, edit /etc/sysconfig/power.
Every time pmud detects an action it executes the configuration files. So make sure they are marked executable: chmod +x /etc/power/*.

If pmud fails with
(bind socket) error
Code listing 5.1
it is because pmud requires the lo interface up and running.

For more information:

[ Top | Bottom ]

CPU frequency scaling

CPUfreq

Enable the following in the kernel:
Power management options  --->
    CPU Frequency scaling  --->
        [*] CPU Frequency scaling
	<*>   CPU frequency translation statistics
	[*]     CPU frequency translation statistics details
	      Default CPUFreq governor (performance)  --->
	<M>   'powersave' governor
	<M>   'userspace' governor for userspace frequency scaling
	<*>   'ondemand' cpufreq policy governor
	<M>   'conservative' cpufreq governor
	<*>   ACPI Processor P-States driver
Code listing 6.1
Remember to enable the specific driver, e.g. "AMD Opteron/Athlon64 PowerNow!" for AMD's Cool'N'Quiet CPU frequency scaling system.

The translation statistics are in: /sys/devices/system/cpu/cpu0/cpufreq/stats/

With this enabled, you should get the following files in /sys/devices/system/cpu/cpu0/cpufreq/:

cpuinfo_max_freq
cpuinfo_min_freq
scaling_available_governors
scaling_driver
scaling_governor
scaling_max_freq
scaling_min_freq
scaling_setspeed
Code listing 6.2
To switch between performance and powersave mode do: echo -n "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

To dynamically adjust the CPU frequency based on the current CPU load you can either use a daemon, or use the "ondemand" scaling_governor.

If you want to use a daemon insted set the scaling_governor to "userspace". Then you can use a daemon like cpudynd or cpufreqd and gnome-cpufreq-applet to display the current frequency in the gnome panel. To manually set the speed while using the userspace governor, do echo -n "300000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

[ Top | Bottom ]
Hi! you have reached the old part of my homepage, be sure to checkout my new site