LinuxCommandLibrary

acpid

Execute commands on ACPI events

SYNOPSIS

acpid [-C confdir] [-d[file]] [-f] [-l file] [-L file] [-m] [-q] [-s socket] [-t sec] [-v] [-x xsocket]

PARAMETERS

-C, --confdir=DIR
    Set configuration directory. Default: /etc/acpi

-d[FILE], --debug[=FILE]
    Enable debug logging to FILE or stdout (use '-')

-f, --foreground
    Run in foreground instead of daemonizing

-l FILE, --logfile=FILE
    Log to specified file

-L FILE, --lockfile=FILE
    PID lockfile path. Default: /var/run/acpid.pid

-m, --multisocket
    Allow multiple acpid instances via different sockets

-q, --quiet
    Suppress info/debug logs; errors only

-s FILE, --socket=FILE
    Unix socket path. Default: /var/run/acpid.socket

-t SEC, --timeout=SEC
    Client socket timeout in seconds. Default: 30

-v, --version
    Print version information and exit

-x FILE, --xsocket=FILE
    XenStore socket for virtualization events

DESCRIPTION

acpid is a flexible, lightweight daemon that receives ACPI (Advanced Configuration and Power Interface) events from the Linux kernel and executes user-defined actions. The kernel sends events via a netlink socket for hardware activities like power button presses, lid closures, battery insertions/removals, thermal zone changes, and docking/undocking.

acpid matches incoming events against rules in /etc/acpi/events/ configuration files. Each file specifies an event identifier, optional mask, and action command or script. For example, a lid-close event might trigger screen blanking or suspend. Actions are executed with the event details passed as arguments, enabling dynamic responses.

Designed for desktops and laptops, acpid enables power management, hotkey handling, and hardware notifications. It runs as root, typically started by init systems like SysV, Upstart, or systemd. Debug mode and foreground operation aid troubleshooting. While powerful, it requires manual configuration and may overlap with modern alternatives like systemd-logind on newer distributions.

Key benefits include modularity—admins customize per-event behaviors—and low resource use. Widely used in enterprise and embedded Linux for consistent power handling across hardware.

CAVEATS

Requires root to bind netlink socket.
May conflict with systemd-logind handling same events; disable logind features or use selectively.
Configuration errors silently fail actions.

CONFIGURATION

Rules in /etc/acpi/events/: format <event> {message 0x01}; action=/script.sh.
Actions receive event data as args; use /etc/acpi/actions/ for scripts.

TESTING

Monitor events: acpi_listen.
Debug: acpid -f -d -l /tmp/acpid.log.
Test action: echo "event=button/power" | /etc/acpi/actions/powerbtn.sh

HISTORY

First released in 2001 by Ted Goranson to provide userspace ACPI support predating kernel integration. Maintained by Linux ACPI project; evolved with netlink API in kernel 2.6+. Common in distros until systemd era.

SEE ALSO

acpi(7), acpi_listen(8), systemd-logind(8), udev(7)

Copied to clipboard