Gentoo Wiki ArchivesGentoo Wiki




Compile your kernel with ACPI enabled

The default kernel comes with this already enabled. To check if you have ACPI compiled and enabled, see if the directory /proc/acpi/ exists. If not, in your kernal enable the following:

Linux Kernel Configuration: Enabling ACPI
  Power management options (ACPI, APM)  --->
    [*] ACPI Support (Advanced Configuration and Power Interface) Support  --->
        [*]   Deprecated /proc/acpi/event support
        <*>   AC Adapter
        <*>   Battery
        <*>   Button
        <*>   Fan
        < >   Dock
        <*>   Processor
        <*>     Thermal Zone

Install acpid

The tools for ACPI are found under sys-power/acpid.

 emerge --ask --verbose sys-power/acpid
Note: As of linux 2.6.23, you will need to manually enable the deprecated /proc/events/acpi option in the kernel. See previous section for kernel configuration.

Running acpid

You can turn it on using:

/etc/init.d/acpid start

To have it start up when you start the machine, add it to the default runlevel:

rc-update add acpid default

If you add any config files while ACPI is running you have to restart it to reload the rules

/etc/init.d/acpid restart


Following are some configuration file examples for setting up ACPI after it is emerged. Remember to make the scripts executable: chmod +x /etc/acpi/<script-filename>


This is only recommended to use on laptops. It will hibernate the computer if it is not connected to AC power supply. On most PCs the required file /proc/acpi/ac_adapter/AC/state does not exist. There might be also issues with the graphics card on some machines, even on laptops. If you've opened a SSH connection to your computer and called hibernate-ram in it. It will shutdown completely. If you press the power-button, you can proceed in your SSH connection but you don't get anything displayed on your monitor - everything else is working fome (according to lspci, etc.).

File: /etc/acpi/events/lid

The following script requires the package "hibernate-script":

 emerge -av hibernate-script
 rc-update add hibernate-cleanup boot
File: /etc/acpi/

if [ "`sed -e "s/.[^ ]* *//" /proc/acpi/ac_adapter/AC/state`" = "on-line" ]
                logger "ACPI: AC adapter is on-line, not hibernating..."
                logger "ACPI: AC adapter is off-line, hibernating..."


This will set your computer to the standby-mode. There aren't high power savings. On this machine, I've got a power saving of 20% compared to idle mode. Note: Your LAN connection will possibly break, so that you cannot use SSH during standby-mode. It's better to shutdown the computer to hibernate as it will save more power. You can wake up your computer from standby-mode through pressing the power-button. Again, this script should only be used if you really have a laptop as it relies on ACPI-events that report the battery status which do not exist on PCs.

File: /etc/acpi/events/sleep
File: /etc/acpi/events/battery
action=echo -e "\a"
File: /etc/acpi/

logger "ACPI: Time to sleep"
touch /tmp/was_sleeping
echo -n standby > /sys/power/state


This script will be executed when pressing the power-button of your computer. It should be also working on PCs with ACPI-support. This script implements three power-modes:

The default is standby. Suspend to disk is not working on most of the computers, use standby or shutdown in this case instead. If you want to use shutdown, note that you will not be able to proceed with your session. It will shutdown your computer completely. If you want to proceed with your work, use standby or suspend to disk instead, if available.

File: /etc/acpi/events/power
File: /etc/acpi/

COMMAND="echo -n standby >| /sys/power/state"  #standby
#COMMAND="echo -n disk >| /sys/power/state"    #suspend to disk
#COMMAND="/etc/init.d/"             #shutdown

if [ ! -f /tmp/was_sleeping ]

                touch /tmp/was_sleeping
                logger "ACPI: Going to sleep..."
                exec $COMMAND
                rm -f /tmp/was_sleeping
                logger "ACPI: Was on S1 state, not going to sleep mode"

Applying changes

Having saved the scripts to disk, you need to reload the configuration. See the "Run" section how to do so.

See also


This page was originally taken from linux.gentoo.user on Google Groups.

Retrieved from ""

Last modified: Sat, 30 Aug 2008 16:00:00 +1000 Hits: 60,302

Created by, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.