16.5. The powersave Package

The powersave package is responsible for the power saving function in laptops during battery operation. Some of its features are also useful for normal workstations and servers, such as suspend, standby, ACPI button functionality, and putting IDE hard disks to sleep.

This package contains 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. Daemons from these packages should not be run concurrently with the powersave daemon.

Even if your system does not contain all the hardware elements listed above, use the powersave daemon for controlling the power saving function. Because ACPI and APM are mutually exclusive, you can only use one of these systems on your computer. The daemon automatically detects any changes in the hardware configuration.

[Important]Information about powersave

Information about the powersave package is also available in /usr/share/doc/packages/powersave.

16.5.1. Configuring the powersave Package

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

/etc/sysconfig/powersave/common

This file contains general settings for the powersave daemon. For example, the amount of debug messages (in /var/log/messages) can be increased by increasing the value of the variable POWERSAVE_DEBUG.

/etc/sysconfig/powersave/events

The powersave daemon needs this file for processing system events. An event can be assigned external actions or actions performed by the daemon itself. For external actions, the daemon tries to run an executable file in /usr/lib/powersave/scripts/. Predefined internal actions:

  • ignore

  • throttle

  • dethrottle

  • suspend_to_disk

  • suspend_to_ram

  • standby

  • do_suspend_to_disk

  • do_suspend_to_ram

  • do_standby

throttle slows down the processor by the value defined in POWERSAVE_MAX_THROTTLING. This value depends on the current scheme. dethrottle sets the processor to full performance. suspend_to_disk, suspend_to_ram, and standby trigger the system event for a sleep mode. These three actions are generally responsible for triggering the sleep mode, but they should always be associated with specific system events.

The directory /usr/lib/powersave/scripts contains scripts for processing events:

notify

Notification about an event by way of the console, X window, or acoustic signal.

screen_saver

Activates the screen saver.

switch_vt

Useful if the screen is displaced after a suspend or standby.

wm_logout

Saves the settings and logs out from GNOME, KDE, or other window managers.

wm_shutdown

Saves the GNOME or KDE settings and shuts down the system.

If, for example, the variable POWERSAVE_EVENT_GLOBAL_SUSPEND2DISK="prepare_suspend_to_disk do_suspend_to_disk" is set, the two scripts or actions are processed in the specified order as soon as the user gives powersaved the command for the sleep mode suspend to disk. The daemon runs the external script /usr/lib/powersave/scripts/prepare_suspend_to_disk. After this script has been processed successfully, the daemon runs the internal action do_suspend_to_disk and sets the computer to the sleep mode after the script has unloaded critical modules and stopped services.

The actions for the event of a sleep button could be modified as in POWERSAVE_EVENT_BUTTON_SLEEP="notify suspend_to_disk". In this case, the user is informed about the suspend by the external script notify. Subsequently, the event POWERSAVE_EVENT_GLOBAL_SUSPEND2DISK is generated, resulting in the execution of the above-mentioned actions and a secure system suspend mode. The script notify can be customized using the variable POWERSAVE_NOTIFY_METHOD in /etc/sysconfig/powersave/common.

/etc/sysconfig/powersave/cpufreq

Contains variables for optimizing the dynamic CPU frequency settings.

/etc/sysconfig/powersave/battery

Contains battery limits and other battery-specific settings.

/etc/sysconfig/powersave/sleep

In this file, activate the sleep modes and determine which critical modules should be unloaded and which services should be stopped prior to a suspend or standby event. When the system is resumed, these modules are reloaded and the services are restarted. You can even delay a triggered sleep mode (in order to be able to save files). The default settings mainly concern USB and PCMCIA modules. A failure of suspend or standby is usually caused by certain modules. See 16.5.4. “Troubleshooting” for more information about identifying the error.

/etc/sysconfig/powersave/thermal

Activates cooling and thermal control. Details about this subject are available in the file /usr/share/doc/packages/powersave/README.thermal.

/etc/sysconfig/powersave/scheme_*

These are the various schemes that adapt the power consumption to certain deployment scenarios. A number of schemes are preconfigured and can be used as they are. Custom schemes can be saved here.

16.5.2. Configuring APM and ACPI

16.5.2.1. Suspend and Standby

By default, the sleep modes are inactive, because they still do not work on some computers. There are three basic ACPI sleep modes and two APM sleep modes:

Suspend to Disk (ACPI S4, APM suspend)

Saves the entire memory content to the hard disk. The computer is switched off completely and does not consume any power.

Suspend to RAM (ACPI S3, APM suspend)

Saves the states of all devices to the main memory. Only the main memory continues consuming power.

Standby (ACPI S1, APM standby)

Switches some devices off (manufacturer-dependent).

Make sure that the following default options are set in the file /etc/sysconfig/powersave/events for the correct processing of suspend, standby, and resume (default settings following the installation of SUSE LINUX):

POWERSAVE_EVENT_GLOBAL_SUSPEND2DISK=
    "prepare_suspend_to_disk do_suspend_to_disk"
POWERSAVE_EVENT_GLOBAL_SUSPEND2RAM=
    "prepare_suspend_to_ram do_suspend_to_ram"
POWERSAVE_EVENT_GLOBAL_STANDBY=
    "prepare_standby do_standby"
POWERSAVE_EVENT_GLOBAL_RESUME_SUSPEND2DISK=
    "restore_after_suspend_to_disk"
POWERSAVE_EVENT_GLOBAL_RESUME_SUSPEND2RAM=
    "restore_after_suspend_to_ram"
POWERSAVE_EVENT_GLOBAL_RESUME_STANDBY=
    "restore_after_standby"

16.5.2.2. Custom Battery States

In the file /etc/sysconfig/powersave/battery, define three battery charge levels (in percent) that trigger system alerts or 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 drop under the specified limits is defined in the configuration file /etc/sysconfig/powersave/events. The standard actions for buttons can be modified as described in 16.5.1. “Configuring the powersave Package”.

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

16.5.2.3. Adapting Power Consumption to Various Conditions

The system behavior can be adapted to the type of power supply. The power consumption of the system should be reduced when the system is disconnected from the AC power supply and operated with the battery. Similarly, the performance should automatically increase as soon as the system is connected to the AC power supply. The CPU frequency, the power saving function of IDE, and a number of other parameters can be modified.

The actions to execute when the computer is disconnected from or connected to the AC power supply are defined in /etc/sysconfig/powersave/events. Select the schemes to use in /etc/sysconfig/powersave/common:

POWERSAVE_AC_SCHEME="performance"
POWERSAVE_BATTERY_SCHEME="powersave"

The schemes are stored in files in /etc/sysconfig/powersave. The file names are made in the format scheme_<name of the scheme>. The example refers to two schemes: scheme_performance and scheme_powersave. performance, powersave, presentation, and acoustic are preconfigured. Existing schemes can be edited, created, deleted, or associated with different power supply states with the help of the YaST power management module (see 16.6. “The YaST Power Management Module”).

16.5.3. Additional ACPI Features

If you use ACPI, you can control the response of your system to ACPI buttons (power, sleep, lid open, and lid closed). Configure execution of the actions in /etc/sysconfig/powersave/events. Refer to this configuration file for an explanation of the individual options.

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_to_disk"

When the sleep button is pressed, the system is set to the suspend-to-disk 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.

16.5.4. Troubleshooting

All error messages and alerts are logged in the file /var/log/messages. If you cannot find the needed information, increase the verbosity of the messages of powersave using DEBUG in the file /etc/sysconfig/powersave/common. Increase the value of the variable to 7 or even 15 and restart the daemon. The more detailed error messages in /var/log/messages should help you to find the error. The following sections cover the most common problems with powersave.

16.5.4.1. ACPI Activated with Hardware Support but Functions Do Not Work

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. Ask 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 is integrated and loaded when the system is booted.

16.5.4.2. 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/cpufreq by means of the variables CPUFREQD_MODULE and CPUFREQD_MODULE_OPTS.

16.5.4.3. 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 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.

On ACPI and APM systems: When the system tries to unload faulty modules, the system is arrested or the suspend event is not triggered. The same can also happen if you do not unload modules or stop services that prevent a successful suspend. In both cases, try to identify the faulty module that prevented the sleep mode. The log files generated by the powersave daemon in /var/log/<sleep mode> are very helpful in this regard. If the computer does not enter the sleep mode, the cause lies in the last module unloaded. Manipulate the following settings in /etc/sysconfig/powersave/sleep to unload problematic modules prior to a suspend or standby.

POWERSAVE_UNLOAD_MODULES_BEFORE_SUSPEND2DISK=""
POWERSAVE_UNLOAD_MODULES_BEFORE_SUSPEND2RAM=""
POWERSAVE_UNLOAD_MODULES_BEFORE_STANDBY=""
POWERSAVE_SUSPEND2DISK_RESTART_SERVICES=""
POWERSAVE_SUSPEND2RAM_RESTART_SERVICES=""
POWERSAVE_STANDBY_RESTART_SERVICES="" 

If you use suspend or standby in changing network environments or in connection with remotely mounted file systems, such as Samba and NIS, use automounter to mount them or add the respective services, for example, smbfs or nfs, in the above-mentioned variable. If an application accesses the remotely mounted file system prior to a suspend or standby, the service cannot be stopped correctly and the file system cannot be unmounted properly. After resuming the system, the file system may be corrupt and must be remounted.

16.5.4.4.  Using ACPI, Powersave Does Not Notice Battery Limits

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/sysconfig/powersave/battery to yes to force battery polling.


SUSE LINUX 9.2