Chapter 28. Power Management

Contents

28.1. Power Saving Functions
28.2. APM
28.3. ACPI
28.4. Rest for the Hard Disk
28.5. The powersave Package
28.6. The YaST Power Management Module

Abstract

Power management is especially important on laptop computers, but is also useful on other systems. Two technologies are available: APM (advanced power management) and ACPI (advanced configuration and power interface). In addition to these, it is also possible to control CPU frequency scaling to save power or decrease noise. These options can be configured manually or using a special YaST module.

►zseries: The features and hardware described in this chapter do not exist on IBM System z, making this chapter irrelevant for these platforms.

Power management is especially important on laptop computers, but is also useful on other systems. ACPI (advanced configuration and power interface) is available on all modern computers (laptops, desktops, and servers). Power management technologies require suitable hardware and BIOS routines. Most laptops and many modern desktops and servers meet these requirements. It is also possible to control CPU frequency scaling to save power or decrease noise.

APM had been used in many older computers. Because APM largely consists of a function set implemented in the BIOS, the level of APM support may vary depending on the hardware. This is even more true of ACPI, which is even more complex. For this reason, it is virtually impossible to recommend one over the other. Simply test the various procedures on your hardware then select the technology that is best supported.

28.1. Power Saving Functions

Power saving functions are not only significant for the mobile use of laptops, but also for desktop systems. The main functions and their use in the power management systems APM and ACPI are:

Standby

This operating mode turns off the display. On some computers, the processor performance is throttled. This function corresponds to the ACPI state S1 or S2.

Suspend (to memory)

This mode writes the entire system state to the RAM. Subsequently, the entire system except the RAM is put to sleep. In this state, the computer consumes very little power. The advantage of this state is the possibility of resuming work at the same point within a few seconds without having to boot and restart applications. This function corresponds to the ACPI state S3. The support of this state is still under development and therefore largely depends on the hardware.

Hibernation (suspend to disk)

In this operating mode, the entire system state is written to the hard disk and the system is powered off. There must be a swap partition at least as big as the RAM to write all the active data. Reactivation from this state takes about 30 to 90 seconds. The state prior to the suspend is restored. Some manufacturers offer useful hybrid variants of this mode, such as RediSafe in IBM Thinkpads. The corresponding ACPI state is S4. In Linux, suspend to disk is performed by kernel routines that are independent from APM and ACPI.

Battery Monitor

ACPI and APM check the battery charge status and provide information about it. Additionally, both systems coordinate actions to perform when a critical charge status is reached.

Automatic Power-Off

Following a shutdown, the computer is powered off. This is especially important when an automatic shutdown is performed shortly before the battery is empty.

Shutdown of System Components

Switching off the hard disk is the greatest single aspect of the power saving potential of the overall system. Depending on the reliability of the overall system, the hard disk can be put to sleep for some time. However, the risk of losing data increases with the duration of the sleep periods. Other components, like PCI devices that can be put into a special power saving mode, can be deactivated with ACPI (at least theoretically) or permanently disabled in the BIOS setup.

Processor Speed Control

In connection with the CPU, energy can be saved in three different ways: frequency and voltage scaling (also known as PowerNow! or Speedstep), throttling, and putting the processor to sleep (C states). Depending on the operating mode of the computer, these methods can also be combined.

28.2. APM

Some of the power saving functions are performed by the APM BIOS itself. On many laptops, standby and suspend states can be activated with key combinations or by closing the lid without any special operating system function. However, to activate these modes with a command, certain actions must be triggered before the system is suspended. To view the battery charge level, you need special program packages and a suitable kernel.

SUSE Linux Enterprise® kernels have built-in APM support. However, APM is only activated if ACPI is not implemented in the BIOS and an APM BIOS is detected. To activate APM support, ACPI must be disabled with acpi=off at the boot prompt. Enter cat /proc/apm to check if APM is active. An output consisting of various numbers indicates that everything is OK. You should now be able to shut down the computer with the command shutdown -h.

BIOS implementations that are not fully standard-compliant can cause problems with APM. Some problems can be circumvented with special boot parameters. All parameters are entered at the boot prompt in the form of apm=parameter with parameter being one of:

on or off

Enable or disable APM support.

(no-)allow-ints

Allow interrupts during the execution of BIOS functions.

(no-)broken-psr

The GetPowerStatus function of the BIOS does not work properly.

(no-)realmode-power-off

Reset processor to real mode prior to shutdown.

(no-)debug

Log APM events in system log.

(no-)power-off

Power system off after shutdown.

bounce-interval=n

Time in hundredths of a second after a suspend event during which additional suspend events are ignored.

idle-threshold=n

System inactivity percentage from which the BIOS function idle is executed (0=always, 100=never).

idle-period=n

Time in hundredths of a second after which the system activity is measured.

The APM daemon (apmd) is no longer used. Its functionality is now handled by the new powersaved, which also supports ACPI and provides many other features.

28.3. ACPI

ACPI (advanced configuration and power interface) was designed to enable the operating system to set up and control the individual hardware components. ACPI supersedes both PnP and APM. It delivers information about the battery, AC adapter, temperature, fan, and system events, like close lid or battery low.

The BIOS provides tables containing information about the individual components and hardware access methods. The operating system uses this information for tasks like assigning interrupts or activating and deactivating components. Because the operating system executes commands stored in the BIOS, the functionality depends on the BIOS implementation. The tables ACPI can detect and load are reported in /var/log/boot.msg. See Section 28.3.4, “Troubleshooting” for more information about troubleshooting ACPI problems.

28.3.1. ACPI in Action

If the kernel detects an ACPI BIOS when the system is booted, ACPI is activated automatically. The boot parameter acpi=force may be necessary for some older machines. The computer must support ACPI 2.0 or later. Check the kernel boot messages in /var/log/boot.msg to see if ACPI was activated.

Subsequently, a number of modules must be loaded. This is done by the start script of acpid. If any of these modules cause problems, the respective module can be excluded from loading or unloading in /etc/sysconfig/powersave/common. The system log (/var/log/messages) contains the messages of the modules, enabling you to see which components were detected.

/proc/acpi now contains a number of files that provide information about the system state or can be used to change some of the states. Some features do not work yet because they are still under development and the support of some functions largely depends on the implementation of the manufacturer.

All files (except dsdt and fadt) can be read with cat. In some files, settings can be modified with echo, for example, echo X > file to specify suitable values for X. One possibility for easy access to those values is the powersave command, which acts as a front-end for the Powersave daemon. The following describes the most important files:

/proc/acpi/info

General information about ACPI.

/proc/acpi/alarm

Here, specify when the system should wake from a sleep state. Currently, this feature is not fully supported.

/proc/acpi/sleep

Provides information about possible sleep states.

/proc/acpi/event

All events are reported here and processed by the Powersave daemon (powersaved). If no daemon accesses this file, events, such as a brief click on the power button or closing the lid, can be read with cat /proc/acpi/event (terminate with Ctrl+C).

/proc/acpi/dsdt and /proc/acpi/fadt

These files contain the ACPI tables DSDT (differentiated system description table) and FADT (fixed ACPI description table). They can be read with acpidmp, acpidisasm, and dmdecode. These programs and their documentation are located in the package pmtools. For example, acpidmp DSDT | acpidisasm.

/proc/acpi/ac_adapter/AC/state

Shows whether the AC adapter is connected.

/proc/acpi/battery/BAT*/{alarm,info,state}

Detailed information about the battery state. The charge level is read by comparing the last full capacity from info with the remaining capacity from state. A more comfortable way to do this is to use one of the special programs introduced in Section 28.3.3, “ACPI Tools”. The charge level at which a battery event (such as warning, low and critical) is triggered can be specified in alarm.

/proc/acpi/button

This directory contains information about various switches, like the laptop lid and buttons.

/proc/acpi/fan/FAN/state

Shows if the fan is currently active. Activate or deactivate the fan manually by writing 0 (on) or 3 (off) into this file. However, both the ACPI code in the kernel and the hardware (or the BIOS) overwrite this setting when the system gets too warm.

/proc/acpi/processor/*

A separate subdirectory is kept for each CPU included in your system.

/proc/acpi/processor/*/info

Information about the energy saving options of the processor.

/proc/acpi/processor/*/power

Information about the current processor state. An asterisk next to C2 indicates that the processor is idle. This is the most frequent state, as can be seen from the usage value.

/proc/acpi/processor/*/throttling

Can be used to set the throttling of the processor clock. Usually, throttling is possible in eight levels. This is independent of the frequency control of the CPU.

/proc/acpi/processor/*/limit

If the performance (outdated) and the throttling are automatically controlled by a daemon, the maximum limits can be specified here. Some of the limits are determined by the system. Some can be adjusted by the user.

/proc/acpi/thermal_zone/

A separate subdirectory exists for every thermal zone. A thermal zone is an area with similar thermal properties whose number and names are designated by the hardware manufacturer. However, many of the possibilities offered by ACPI are rarely implemented. Instead, the temperature control is handled conventionally by the BIOS. The operating system is not given much opportunity to intervene, because the life span of the hardware is at stake. Therefore, some of the files only have a theoretical value.

/proc/acpi/thermal_zone/*/temperature

Current temperature of the thermal zone.

/proc/acpi/thermal_zone/*/state

The state indicates if everything is ok or if ACPI applies active or passive cooling. In the case of ACPI-independent fan control, this state is always ok.

/proc/acpi/thermal_zone/*/cooling_mode

Select the cooling method controlled by ACPI. Choose from passive (less performance, economical) or active cooling mode (full performance, fan noise).

/proc/acpi/thermal_zone/*/trip_points

Enables the determination of temperature limits for triggering specific actions, like passive or active cooling, suspension (hot), or a shutdown (critical). The possible actions are defined in the DSDT (device-dependent). The trip points determined in the ACPI specification are critical, hot, passive, active1, and active2. Even if not all of them are implemented, they must always be entered in this file in this order. For example, the entry echo 90:0:70:0:0 > trip_points sets the temperature for critical to 90 and the temperature for passive to 70 (all temperatures measured in degrees Celsius).

/proc/acpi/thermal_zone/*/polling_frequency

If the value in temperature is not updated automatically when the temperature changes, toggle the polling mode here. The command echo X > /proc/acpi/thermal_zone/*/polling_frequency causes the temperature to be queried every X seconds. Set X=0 to disable polling.

None of these settings, information, and events need to be edited manually. This can be done with the Powersave daemon (powersaved) and its various front-ends, like powersave, kpowersave, and wmpowersave. See Section 28.3.3, “ACPI Tools”.

28.3.2. Controlling the CPU Performance

The CPU can save energy in three ways. Depending on the operating mode of the computer, these methods can be combined. Saving energy also means that the system heats up less and the fans are activated less frequently.

Frequency and Voltage Scaling

PowerNow! and Speedstep are the designations AMD and Intel use for this technology. However, this technology is also applied in processors of other manufacturers. The clock frequency of the CPU and its core voltage are reduced at the same time, resulting in more than linear energy savings. This means that when the frequency is halved (half performance), far less than half of the energy is consumed. This technology is independent from APM or ACPI. There are two main approaches to performing CPU frequency scaling—by the kernel itself or by a userspace application. Therefore, there are different kernel governors that can be set below /sys/devices/system/cpu/cpu*/cpufreq/.

userspace governor

If the userspace governor is set, the kernel gives the control of CPU frequency scaling to a userspace application, usually a daemon. In SUSE Linux Enterprise distributions, this daemon is the powersaved package. When this implementation is used, the CPU frequency is adjusted in regard to the current system load. By default, one of the kernel implementations is used. However, on some hardware or in regard to specific processors or drivers, the userspace implementation is still the only working solution.

ondemand governor

This is the kernel implementation of a dynamic CPU frequency policy and should work on most systems. As soon as there is a high system load, the CPU frequency is immediately increased. It is lowered on a low system load.

conservative governor

This governor is similar to the on demand implementation, except that a more conservative policy is used. The load of the system must be high for a specific amount of time before the CPU frequency is increased.

powersave governor

The cpu frequency is statically set to the lowest possible.

performance governor

The cpu frequency is statically set to the highest possible.

Throttling the Clock Frequency

This technology omits a certain percentage of the clock signal impulses for the CPU. At 25% throttling, every fourth impulse is omitted. At 87.5%, only every eighth impulse reaches the processor. However, the energy savings are a little less than linear. Normally, throttling is only used if frequency scaling is not available or to maximize power savings. This technology, too, must be controlled by a special process. The system interface is /proc/acpi/processor/*/throttling.

Putting the Processor to Sleep

The operating system puts the processor to sleep whenever there is nothing to do. In this case, the operating system sends the CPU a halt command. There are three states: C1, C2, and C3. In the most economic state, C3, even the synchronization of the processor cache with the main memory is halted. Therefore, this state can only be applied if no other device modifies the contents of the main memory via bus master activity. Some drivers prevent the use of C3. The current state is displayed in /proc/acpi/processor/*/power.

Frequency scaling and throttling are only relevant if the processor is busy, because the most economic C state is applied anyway when the processor is idle. If the CPU is busy, frequency scaling is the recommended power saving method. Often the processor only works with a partial load. In this case, it can be run with a lower frequency. Usually, dynamic frequency scaling controlled by the kernel on demand governor or a daemon, such as powersaved, is the best approach. A static setting to a low frequency is useful for battery operation or if you want the computer to be cool or quiet.

Throttling should be used as the last resort, for example, to extend the battery operation time despite a high system load. However, some systems do not run smoothly when they are throttled too much. Moreover, CPU throttling does not make sense if the CPU has little to do.

In SUSE Linux Enterprise these technologies are controlled by the powersave daemon. The configuration is explained in Section 28.5, “The powersave Package”.

28.3.3. ACPI Tools

The range of more or less comprehensive ACPI utilities includes tools that merely display information, like the battery charge level and the temperature (acpi, klaptopdaemon, wmacpimon, etc.), tools that facilitate the access to the structures in /proc/acpi or that assist in monitoring changes (akpi, acpiw, gtkacpiw), and tools for editing the ACPI tables in the BIOS (package pmtools).

28.3.4. Troubleshooting

There are two different types of problems. On one hand, the ACPI code of the kernel may contain bugs that were not detected in time. In this case, a solution will be made available for download. More often, however, the problems are caused by the BIOS. Sometimes, deviations from the ACPI specification are purposely integrated in the BIOS to circumvent errors in the ACPI implementation in other widespread operating systems. Hardware components that have serious errors in the ACPI implementation are recorded in a blacklist that prevents the Linux kernel from using ACPI for these components.

The first thing to do when problems are encountered is to update the BIOS. If the computer does not boot at all, one of the following boot parameters may be helpful:

pci=noacpi

Do not use ACPI for configuring the PCI devices.

acpi=ht

Only perform a simple resource configuration. Do not use ACPI for other purposes.

acpi=off

Disable ACPI.

[Warning]Problems Booting without ACPI

Some newer machines (especially SMP systems and AMD64 systems) need ACPI for configuring the hardware correctly. On these machines, disabling ACPI can cause problems.

Monitor the boot messages of the system with the command dmesg | grep -2i acpi (or all messages, because the problem may not be caused by ACPI) after booting. If an error occurs while parsing an ACPI table, the most important table—the DSDT—can be replaced with an improved version. In this case, the faulty DSDT of the BIOS is ignored. The procedure is described in Section 28.5.4, “Troubleshooting”.

In the kernel configuration, there is a switch for activating ACPI debug messages. If a kernel with ACPI debugging is compiled and installed, experts searching for an error can be supported with detailed information.

If you experience BIOS or hardware problems, it is always advisable to contact the manufacturers. Especially if they do not always provide assistance for Linux, they should be confronted with the problems. Manufacturers will only take the issue seriously if they realize that an adequate number of their customers use Linux.

28.3.4.1. For More Information

Additional documentation and help on ACPI:

28.4. Rest for the Hard Disk

In Linux, the hard disk can be put to sleep entirely if it is not needed or it can be run in a more economic or quieter mode. On modern laptops, you do not need to switch off the hard disks manually, because they automatically enter an economic operating mode whenever they are not needed. However, if you want to maximize power savings, test some of the following methods. Most of the functions can be controlled with powersaved and the YaST power management module, which is discussed in further detail in Section 28.6, “The YaST Power Management Module”.

The hdparm application can be used to modify various hard disk settings. The option -y instantly switches the hard disk to the standby mode. -Y puts it to sleep. hdparm -S x causes the hard disk to be spun down after a certain period of inactivity. Replace x as follows: 0 disables this mechanism, causing the hard disk to run continuously. Values from 1 to 240 are multiplied by 5 seconds. Values from 241 to 251 correspond to 1 to 11 times 30 minutes.

Internal power saving options of the hard disk can be controlled with the option -B. Select a value from 0 to 255 for maximum saving to maximum throughput. The result depends on the hard disk used and is difficult to assess. To make a hard disk quieter, use the option -M. Select a value from 128 to 254 for quiet to fast.

Often, it is not so easy to put the hard disk to sleep. In Linux, numerous processes write to the hard disk, waking it up repeatedly. Therefore, it is important to understand how Linux handles data that needs to be written to the hard disk. First, all data is buffered in the RAM. This buffer is monitored by the kernel update daemon (kupdated). When the data reaches a certain age limit or when the buffer is filled to a certain degree, the buffer content is flushed to the hard disk. The buffer size is dynamic and depends on the size of the memory and the system load. By default, kupdated is set to short intervals to achieve maximum data integrity. It checks the buffer every 5 seconds and notifies the bdflush daemon when data is older than 30 seconds or the buffer reaches a fill level of 30%. The bdflush daemon then writes the data to the hard disk. It also writes independently from kupdated if, for instance, the buffer is full.

[Warning]Impairment of the Data Integrity

Changes to the kernel update daemon settings endanger the data integrity.

Apart from these processes, journaling file systems, like ReiserFS and Ext3, write their metadata independently from bdflush, which also prevents the hard disk from spinning down. To avoid this, a special kernel extension has been developed for mobile devices. See /usr/src/linux/Documentation/laptop-mode.txt for details.

Another important factor is the way active programs behave. For example, good editors regularly write hidden backups of the currently modified file to the hard disk, causing the disk to wake up. Features like this can be disabled at the expense of data integrity.

In this connection, the mail daemon postfix makes use of the variable POSTFIX_LAPTOP. If this variable is set to yes, postfix accesses the hard disk far less frequently. However, this is irrelevant if the interval for kupdated was increased.

28.5. The powersave Package

The powersave package cares about all the previously-mentioned power saving functions. Due to the increasing demand for lower energy consumption in general, some of its features are also important on workstations and servers, such as suspend, standby, or CPU frequency scaling.

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 functions from the packages apmd, acpid, ospmd, and cpufreqd (now cpuspeed) have been consolidated in the powersave package. Daemons from these packages, except acpid that acts as a multiplexer for ACPI events, 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.

28.5.1. Configuring the powersave Package

The configuration of powersave is distributed to several files. Every configuration option listed there contains additional documentation about its functionality.

/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 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 (usually a Bash script) in /usr/lib/powersave/scripts/. Predefined internal actions are:

  • ignore

  • throttle

  • dethrottle

  • suspend_to_disk

  • suspend_to_ram

  • standby

  • do_suspend_to_disk

  • do_suspend_to_ram

  • do_standby

  • notify

  • screen_saver

  • reread_cpu_capabilities

throttle slows down the processor by the value defined in 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:

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.

set_disk_settings

Executes the disk settings made in /etc/sysconfig/powersave/disk.

If, for example, the variable 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 EVENT_BUTTON_SLEEP="notify suspend_to_disk". In this case, the user is informed about the suspend by a pop-up window in X or a message on the console. Subsequently, the event EVENT_GLOBAL_SUSPEND2DISK is generated, resulting in the execution of the mentioned actions and a secure system suspend mode. The internal action notify can be customized using the variable NOTIFY_METHOD in /etc/sysconfig/powersave/common.

/etc/sysconfig/powersave/cpufreq

Contains variables for optimizing the dynamic CPU frequency settings and whether the user space or the kernel implementation should be used.

/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, for example, 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 Section 28.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/disk

This configuration file controls the actions and settings made regarding the hard disk.

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

28.5.2. Configuring APM and ACPI

28.5.2.1. Suspend and Standby

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. This sleep mode is enabled by default and should work on all systems.

Suspend to RAM (ACPI S3, APM suspend)

Saves the states of all devices to the main memory. Only the main memory continues consuming power. SUSE Linux Enterprise does not generally support this sleep mode although you can use it for quite a number of machines.

This sleep mode is enabled by default, but it is only executed if the current machine is listed in a database as capable of supporting this mode. This database is contained in the /usr/sbin/s2ram binary provided by the suspend package.

To modify the default parameters (for example, to generally disable the suspend to ram sleep mode or to force it even for machines not listed in the database), find more information about available options in the /etc/sysconfig/powersave/sleep configuration file.

To learn more about the s2ram binary, refer to the README files in /usr/share/doc/packages/suspend.

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 Enterprise):

EVENT_GLOBAL_SUSPEND2DISK=
    "prepare_suspend_to_disk screen_saver do_suspend_to_disk"
EVENT_GLOBAL_SUSPEND2RAM=
    "prepare_suspend_to_ram screen_saver do_suspend_to_ram"
EVENT_GLOBAL_STANDBY=
    "prepare_standby screen_saver do_standby"
EVENT_GLOBAL_RESUME_SUSPEND2DISK=
    "restore_after_suspend_to_disk"
EVENT_GLOBAL_RESUME_SUSPEND2RAM=
    "restore_after_suspend_to_ram"
EVENT_GLOBAL_RESUME_STANDBY=
    "restore_after_standby"

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

BATTERY_WARNING=12
BATTERY_LOW=7
BATTERY_CRITICAL=2

The actions or scripts to execute when the charge levels drop under the specified limits are defined in the configuration file /etc/sysconfig/powersave/events. The standard actions for buttons can be modified as described in Section 28.5.1, “Configuring the powersave Package”.

EVENT_BATTERY_NORMAL="ignore"
EVENT_BATTERY_WARNING="notify"
EVENT_BATTERY_LOW="notify"
EVENT_BATTERY_CRITICAL="wm_shutdown"

28.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:

AC_SCHEME="performance"
BATTERY_SCHEME="powersave"

The schemes are stored in files in /etc/sysconfig/powersave. The filenames are 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 described in Section 28.6, “The YaST Power Management Module”.

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

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

EVENT_BUTTON_SLEEP="suspend_to_disk"

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

EVENT_BUTTON_LID_OPEN="ignore"

Nothing happens when the lid is opened.

EVENT_BUTTON_LID_CLOSED="screen_saver"

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

EVENT_OTHER="ignore"

This event happens if an unknown event is encountered by the daemon. Unknown events include ACPI hot keys on some machines.

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 PROCESSOR_IDLE_LIMIT and the time-out in CPU_IDLE_TIMEOUT. If the CPU load stays below the limit longer than the time-out, the event configured in EVENT_PROCESSOR_IDLE is activated. If the CPU is busy again, EVENT_PROCESSOR_BUSY is executed.

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

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

If you experience problems with ACPI, use the command dmesg|grep -i acpi to search the output of dmesg for ACPI-specific messages. 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/index.php. 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), compile it with iasl (package pmtools). Enter the command iasl -sa file.asl. The latest version of iasl (Intel ACPI compiler) is available at http://www.acpica.org/downloads/.

  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 install the kernel and use mkinitrd to create an initrd, the modified DSDT is integrated and loaded when the system is booted.

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

28.5.4.3. Suspend and Standby Do Not Work

ACPI systems may have problems with suspend and standby due to a faulty DSDT implementation (BIOS). If this is the case, update the BIOS.

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/suspend2ram.log and /var/log/suspend2disk.log 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.

UNLOAD_MODULES_BEFORE_SUSPEND2DISK=""
UNLOAD_MODULES_BEFORE_SUSPEND2RAM=""
UNLOAD_MODULES_BEFORE_STANDBY=""
SUSPEND2DISK_RESTART_SERVICES=""
SUSPEND2RAM_RESTART_SERVICES=""
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.

28.5.5. For More Information

28.6. The YaST Power Management Module

The YaST power management module can configure all power management settings already described. When started from the YaST Control Center with System+Power Management, the first dialog of the module opens (see Figure 28.1, “Scheme Selection”).

Figure 28.1. Scheme Selection

Scheme Selection

In this dialog, select the schemes to use for battery operation and AC operation. To add or modify the schemes, click Edit Schemes, which opens an overview of the existing schemes like that shown in Figure 28.2, “Overview of Existing Schemes”.

Figure 28.2. Overview of Existing Schemes

Overview of Existing Schemes

In the scheme overview, select the scheme to modify then click Edit. To create a new scheme, click Add. The dialog that opens is the same in both cases and is shown in Figure 28.3, “Configuring a Scheme”.

Figure 28.3. Configuring a Scheme

Configuring a Scheme

First, enter a suitable name and description for the new or edited scheme. Determine if and how the CPU performance should be controlled for this scheme. Decide if and to what extent frequency scaling and throttling should be used and whether processes with low priority (niced processes) should be ignored when adjusting the CPU frequency. In the following dialog for the hard disk, define a Standby Policy for maximum performance or for energy saving. The Acoustic Policy controls the noise level of the hard disk (supported by few hard disks). The Cooling Policy determines the cooling method to use. Unfortunately, this type of thermal control is rarely supported by the BIOS. Read /usr/share/doc/packages/powersave/powersave_manual.html#Thermal to learn how you can use the fan and passive cooling methods.

Global power management settings can also be made from the initial dialog using Battery Warning, ACPI Settings, or Suspend Permissions. Access these controls by clicking Other Settings and selecting the appropriate item from the menu. Click Battery Warning to access the dialog for the battery charge level, shown in Figure 28.4, “Battery Charge Level”.

Figure 28.4. Battery Charge Level

Battery Charge Level

The BIOS of your system notifies the operating system whenever the charge level drops under certain configurable limits. In this dialog, define three limits: Warning Capacity, Low Capacity, and Critical Capacity. Specific actions are triggered when the charge level drops under these limits. Usually, the first two states merely trigger a notification to the user. The third critical level triggers a shutdown, because the remaining energy is not sufficient for continued system operation. Select suitable charge levels and the desired actions then click OK to return to the start dialog.

Figure 28.5. ACPI Settings

ACPI Settings

Access the dialog for configuring the ACPI buttons using ACPI Settings. It is shown in Figure 28.5, “ACPI Settings”. The settings for the ACPI buttons determine how the system should respond to certain switches. Configure the system response to pressing the power button, pressing the sleep button, and closing the laptop lid. Click OK to complete the configuration and return to the start dialog.

Click Enable Suspend to enter a dialog in which to determine if and how users of this system may use the suspend or standby functionality. Click OK to return to the main dialog. Click OK again to exit the module and confirm your power management settings.