Difference between revisions of "Shutdown Pressing Power Button"

From ArchWiki
Jump to: navigation, search
(Remove HAL as it is depreciated)
(where I found my solution at least)
(27 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Power management (English)]]
+
[[Category:Power management]]
{{i18n|Shutdown Pressing Power Button}}
+
[[es:Shutdown Pressing Power Button]]
First of all, make sure that "button" module is loaded (check the output of lsmod). If it's not, load it manually
+
[[it:Shutdown Pressing Power Button]]
# modprobe button
+
[[ru:Shutdown Pressing Power Button]]
or add it to your [[Rc.conf#Hardware|/etc/rc.conf MODULES array]] so that it's automatically loaded at boot time.
+
[[uk:Shutdown Pressing Power Button]]
 +
[[zh-CN:Shutdown Pressing Power Button]]
 +
{{stub|reason=should likely just be a redirect now}}
 +
First of all, make sure that {{ic|button}} [[Kernel modules|module]] is loaded (check the output of {{ic|lsmod}}). If it is not, load it manually and set it to load at boot.
  
# Install acpid.
+
{{ic|logind}} handles the event from pressing the power key, and the behaviour can be configured in {{ic|/etc/systemd/logind.conf}}. See https://wiki.archlinux.org/index.php/Systemd#ACPI_power_management for more information.
# If there is no hal in the DAEMONS array in rc.conf, add acpid to the DAEMONS array.
+
# Edit /etc/acpi/handler.sh (as root):
+
 
+
...
+
case "$1" in
+
    button/power)
+
        #echo "PowerButton pressed!">/dev/tty5
+
        case "$2" in
+
            PWRF)  logger "PowerButton pressed: $2"
+
    /sbin/poweroff;;
+
            *)      logger "ACPI action undefined: $2" ;;
+
        esac
+
        ;;
+
...
+
 
+
To be able to test it, make sure the acpid daemon is started.
+
 
+
If you do not have hal, start the acpid daemon yourself:
+
# /etc/rc.d/acpid start
+
 
+
Otherwise restart hal, it will take care of acpid:
+
# /etc/rc.d/hal restart
+

Revision as of 20:14, 4 November 2012

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: should likely just be a redirect now (Discuss in Talk:Shutdown Pressing Power Button#)

First of all, make sure that button module is loaded (check the output of lsmod). If it is not, load it manually and set it to load at boot.

logind handles the event from pressing the power key, and the behaviour can be configured in /etc/systemd/logind.conf. See https://wiki.archlinux.org/index.php/Systemd#ACPI_power_management for more information.