9.5. powersave

On laptops, the powersave package can be used to control the power saving function during battery operation. Some of the features of this package can also be used on normal workstations and servers (suspend, standby, ACPI button functionality, putting IDE hard disks to sleep).

This package comprises all power management features of your computer. It supports hardware using ACPI, APM, IDE hard disks, and PowerNow! or SpeedStep technologies. The functionalities from the packages apmd, acpid, ospmd, and cpufreqd (now cpuspeed) have been consolidated in the powersave package. For this reason, daemons from these packages should not be run together with the powersave daemon.

Even if your system does not have all hardware elements listed above (APM and ACPI are mutually exclusive), use the powersave daemon for controlling the power saving function. The daemon will automatically detect any changes in the hardware configuration.

[Important]Information about powersave

Apart from this chapter, topical information about the powersave package is also available in /usr/share/doc/packages/powersave/README_POWERSAVE.

9.5.1. Configuration of powersave

Normally, the configuration of powersave is distributed to several files:

/etc/powersave.conf

The powersave daemon needs this file for delegating system events to the powersave_proxy. Additionally, custom settings for the behavior of the daemon can be made in this file.

/etc/sysconfig/powersave/common

This file provides the general configuration of the start-up script (rcpowersave) and the proxy. Usually, the default settings can be adopted as they are.

/etc/sysconfig/powersave/scheme_*

These are the various schemes or profiles that control the adaption of the power consumption to specific scenarios, some of which are already preconfigured and ready to use without any changes. Any custom profiles can be saved here.

9.5.2. Configuration of APM and ACPI

9.5.2.1. Suspend and Standby

In the file /etc/sysconfig/powersave/common, specify any critical modules and services that need to be unloaded or stopped prior to a suspend or standby event. When the system operation is resumed, these modules and services will be reloaded or restarted. The default settings mainly affect USB and PCMCIA modules.

POWERSAVE_SUSPEND_RESTART_SERVICES=""

List the services to restart after a suspend.

POWERSAVE_STANDBY_RESTART_SERVICES=""

List the services to restart after a standby.

POWERSAVE_UNLOAD_MODULES_BEFORE_SUSPEND=""

List the modules to unload before a suspend.

POWERSAVE_UNLOAD_MODULES_BEFORE_STANDBY=""

List the modules to unload before a standby.

Make sure that the following standard options for the correct processing of suspend, standby, occurrence, and resume are set (normally, these are the default settings following the installation of SUSE LINUX):

POWERSAVE_EVENT_GLOBAL_SUSPEND="prepare_suspend"
POWERSAVE_EVENT_GLOBAL_STANDBY="prepare_standby"
POWERSAVE_EVENT_GLOBAL_RESUME_SUSPEND="restore_after_suspend"
POWERSAVE_EVENT_GLOBAL_RESUME_STANDBY="restore_after_standby"

In /etc/powersave.conf (configuration file of the powersave daemon), these events are allocated to the powersave_proxy script. This script is executed when these events occur (default setting following the installation):

global.suspend=/usr/sbin/powersave_proxy
global.standby=/usr/sbin/powersave_proxy
global.resume.suspend=/usr/sbin/powersave_proxy
global.resume.standby=/usr/sbin/powersave_proxy

9.5.2.2. User-Defined Battery States

In the file /etc/powersave.conf, define three battery charge levels (in percent) that trigger system alerts or execute specific actions when they are reached.

POWERSAVED_BATTERY_WARNING=20
POWERSAVED_BATTERY_LOW=10
POWERSAVED_BATTERY_CRITICAL=5

The actions or scripts to execute when the charge levels drops under the specified limits are defined in /etc/powersave.conf. The action type is configured in /etc/sysconfig/powersave/common:

POWERSAVE_EVENT_BATTERY_NORMAL="ignore"
POWERSAVE_EVENT_BATTERY_WARNING="notify"
POWERSAVE_EVENT_BATTERY_LOW="notify"
POWERSAVE_EVENT_BATTERY_CRITICAL="suspend"

Further options are explained in this configuration file.

9.5.2.3. Adapting the Power Consumption to Various Conditions

The system behavior can be adapted to the type of power supply. Thus, the power consumption of the system should be reduced when the system is disconnected from the AC power supply and operated with the battery. In the same way, the performance should automatically be increased as soon as the system is connected to the AC power supply. The CPU frequency, the power saving function of IDE hard disks, and some other factors can be modified.

In /etc/powersave.conf, the execution of the actions triggered by the disconnection from or connection to the AC power supply is delegated to powersave_proxy. The scenarios (called schemes or profiles) to apply can be defined in /etc/sysconfig/powersave/common:

POWERSAVE_AC_SCHEME="performance"
POWERSAVE_BATTERY_SCHEME="powersave"

The schemes are located in files designated as scheme_<name of the scheme> in /etc/sysconfig/powersave. The example refers to two schemes: scheme_performance and scheme_powersave. performance, powersave, and acoustic are preconfigured. The YaST Power Management module can be used to edit, create, and delete schemes or change their association with specific power supply states.

9.5.3. Additional ACPI Features

If you use ACPI, you can control the response of your system to ACPI buttons (Power, Sleep, Lid Open, Lid Closed). In /etc/powersave.conf, the execution of the respective actions is delegated to the powersave_proxy. The action itself is defined in the file /etc/sysconfig/powersave/common. The individual options are explained in this configuration file.

POWERSAVE_EVENT_BUTTON_POWER="wm_shutdown"

When the power button is pressed, the system responds by shutting down the respective window manager (KDE, GNOME, fvwm, etc.).

POWERSAVE_EVENT_BUTTON_SLEEP="suspend"

When the sleep button is pressed, the system is set to the suspend mode.

POWERSAVE_EVENT_BUTTON_LID_OPEN="ignore"

Nothing happens when the lid is opened.

POWERSAVE_EVENT_BUTTON_LID_CLOSED="screen_saver"

When the lid is closed, the screen saver is activated.

Further throttling of the CPU performance is possible if the CPU load does not exceed a specified limit for a specified time. Specify the load limit in POWERSAVED_CPU_LOW_LIMIT and the time-out in POWERSAVED_CPU_IDLE_TIMEOUT.

9.5.4. Troubleshooting

The following items cover the most frequent problems in connection with powersave.

  • I have a problem, but I am not able to find the cause.

    Take a look at /var/log/messages. All error messages and alerts are logged there. If you cannot find the needed information, use the variable DEBUG for powersave in the file /etc/sysconfig/powersave/common to increase the verbosity of the messages. Increase the value of the variable to 7 or even 15 and restart the daemon. The error messages in /var/log/messages will now be more detailed, enabling you to identify the error.

  • Although I activated ACPI, the battery states and buttons do not work as configured.

    If you experience problems with ACPI, use the following command to search the output of dmesg for ACPI-specific messages: dmesg|grep -i acpi. A BIOS update may be required to resolve the problem. Go to the home page of your laptop manufacturer, look for an updated BIOS version, and install it. Request the manufacturer to comply with the latest ACPI specification. If the errors persist after the BIOS update, proceed as follows to replace the faulty DSDT table in your BIOS with an updated DSDT:

    1. Download the DSDT for your system from http://acpi.sourceforge.net/dsdt/tables. Check if the file is decompressed and compiled as shown by the file extension .aml (ACPI machine language). If this is the case, continue with step 3.

    2. If the file extension of the downloaded table is .asl (ACPI source language), it must be compiled with iasl (package pmtools). To do this, enter the command iasl -sa <file>.asl. The latest version of iasl (Intel ACPI Compiler) is available at http://developer.intel.com/technology/iapc/acpi/downloads.htm.

    3. Copy the file DSDT.aml to any location (/etc/DSDT.aml is recommended). Edit /etc/sysconfig/kernel and adapt the path to the DSDT file accordingly. Start mkinitrd (package mkinitrd). Whenever you uninstall the kernel and use mkinitrd to create an initrd, the modified DSDT will be integrated and loaded when the system is booted.

  • CPU frequency does not work.

    Refer to the kernel sources (kernel-source) to see if your processor is supported. You may need a special kernel module or module option to activate CPU frequency control. This information is available in /usr/src/linux/Documentation/cpu-freq/*. If a special module or module option is needed, configure it in the file /etc/sysconfig/powersave/common by means of the variables CPUFREQD_MODULE and CPUFREQD_MODULE_OPTS.

  • Suspend and standby do not work.

    There are several kernel-related problems that prevent the use of suspend and standby on ACPI systems:

    • Currently, systems with more than 1 GB RAM do not (yet) support suspend.

    • Currently, multiprocessor systems and systems with a P4 processor (with hyperthreading) do not support suspend.

    The error may also be due to a faulty DSDT implementation (BIOS). If this is the case, install a new DSDT as described under Although I activated ACPI, the battery states and buttons do not work as configured..

    On ACPI and APM systems:

    When the system attempts to unload faulty modules, the proxy is arrested and the suspend event is not triggered. The same can happen if you do not unload modules or stop services that prevent a successful suspend. In both cases, try to identify the modules causing the problem by manipulating the following settings in /etc/sysconfig/powersave/common:

    POWERSAVE_UNLOAD_MODULES_BEFORE_SUSPEND=""
    POWERSAVE_UNLOAD_MODULES_BEFORE_STANDBY=""
    POWERSAVE_SUSPEND_RESTART_SERVICES=""
    POWERSAVE_STANDBY_RESTART_SERVICES=""
    
  • When using ACPI, the powersave daemon does not notice when a certain battery limit is reached.

    With ACPI, the operating system can request the BIOS to send a message when the battery charge level drops under a certain limit. The advantage of this method is that the battery state does not need to be polled constantly, which would impair the performance of the computer. However, this notification may not take place when the charge level drops under the specified limit, even though the BIOS supposedly supports this feature. If this happens on your system, set the variable POWERSAVED_FORCE_BATTERY_POLLING in the file /etc/powersave.conf to yes to force battery polling.