Redhat 8 ACPI/Power Button Guide

Mauriat Miranda (

Other Guides/Resources

Published: 20 December 2002 (updated: 20 December 2002)

NOTE: The content of this page may be outdated. Links may not be valid and the steps detailed may no longer work. This page is saved for archival purposes only.

From: Mauriat Miranda
Subject: Re: Turn server off by hitting "power" button? - semi howto on acpi/power button
Newsgroups: comp.os.linux.hardware, comp.os.linux.misc, comp.os.linux.setup
Date: 2002-12-20 19:47:37 PST
George Adams wrote:
> Hi, all.  I have several Linux boxes (RH 7.3), most of which don't have a
> monitor attached.  Usually that's fine, except when I need to shut them down
> or reboot them.  Then I have to ssh into each one in turn, login, and run

> "poweroff".
> Now I've seen that some Windows computers have software (maybe from Dell?)
> that allows it to execute a clean shutdown when the (soft) power button is

> pushed.  So I'm wondering, is there equivalent software for Linux?  Is there
> a way that I can have it execute "poweroff" and shut itself down nicely when
> the power button is pushed?
> And related to that, is there a way I can have it execute "reboot" when the
> reset button is pushed?  (I'm guessing the answer to that one is "no" -

> seems like the reset button always triggers a hard reset, and can't be
> intercepted by software.  But I'm still hopefull that the power button
> function can be intercepted).

> Thanks to anyone who can help!

Installing ACPI in RH Linux
This assumes:
 You know how to recompile your kernel
 Install RPM/tar.gz files
 Edit config files

Subject to Error, feel free to correct.


Grab the following (3):

* Kernel 2.4.20 (
NOTE: Any newer kernel should work, but the latest is recommended.

* Kernel 2.4.20 ACPI-Patch (grab latest CVS)
file: acpi-20021212-2.4.20.diff.gz
NOTE: If you pick a different kernel, make sure your obtain the
appropriate patch.
* ACPI Daemon

file: acpid-1.0.1-1.i386.rpm
The RPM worked fine for me. Grab the tarball if you prefer.

Basic procedure

1. Decompress the kernel like normal.

2. Apply the ACPI-patch (use the 'patch' command)

3. Compile your kernel like you normally would, note the following:

In 'make xconfig'
In 'General Setup' > 'ACPI Support'
Make sure to enable 'ACPI Support'
Add all the devices you want, compile as MODULES (Important!)
(I would select everything except 'CPU Enumeration', 'Toshiba...' and 
'Debug Statements' -- I don't think these are needed normally)
4. Install the acpi daemon RPM

This should add a 'acpid' entry in /etc/rc.d/init.d/

5. Edit '/etc/rc.d/init.d/acpid'

Go to the start() section.
Add the following script code after start(){
# Load ACPI Drivers
for DRIVER in /lib/modules/`uname -r`/kernel/drivers/acpi/*.o ; do
 DRIVER=`basename $DRIVER`
 /sbin/modprobe ${DRIVER%%.o} 1>/dev/null 2>&1

If you only want to load 1 driver, instead of the above, only add the 
following (replace button with whichever you want):

/sbin/modprobe button 1>/dev/null 2>&1

Go to the stop() section.
Add the following script code after stop() {
# Unload ACPI Drivers
for DRIVER in /lib/modules/`uname -r`/kernel/drivers/acpi/*.o ; do
 DRIVER=`basename $DRIVER`
 /sbin/rmmod ${DRIVER%%.o} 1>/dev/null 2>&1

NOTE: Important! For this to work, you MUST compile the ACPI devices as 
modules. It is possible to compile them into the kernel, in which the 
above modification to acpid would NOT be necessary. I have not tested 
this though.
6. You have to add an an entry to the ACPID configuration
You can edit entries /etc/acpi/events/sample.conf

NOTE: I don't understand this file however got the power button by doing 
the following:

I created the file 'powerbtn' in /etc/acpi/events/
The contents of the file:

event=button[ /]power

You can replace the action with any command you like (poweroff, halt, or 
change runlevels, etc)
7. Edit you services to run the acpid daemon as boot
In RH I run '/usr/bin/serviceconf'
For runlevel 5 and 3
 enable acpid
 disable apmd
Save changes

Once your kernel is compiled (as well as lilo or grub edits) and the 
above changes are made, just reboot into your new kernel. Pressing the 
power button executes a perfect shutdown.

The information may not be entirely correct but DOES WORK for me. This 
has worked on my Athlon T-Bird and Athlon XP machines both on RH8.0 
Kernel 2.4.20. I have yet to try on RH7.3.

Good luck.

Comments, suggestions, questions or any feedback welcome for this page or any of my Resources. Please use the contact link.

Help Out: If you found this guide or any Resource helpful, please consider supporting this site by recommending this page to others or linking to this page. I appreciate all the support I receive. Thank you in advance.

Disclaimer: The author makes no claim to the accuracy of the information provided. This information is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY. There is no implied support from referencing this guide. Any help that is provided is at will. Use this information at your own risk. Always make proper backups and use caution when modifying critical system files.

PLEASE DO NOT mirror, translate or duplicate this page without contacting me.

Copyright © 2003-2013 by Mauriat Miranda (