LinuxCommandLibrary

acpid

Execute commands on ACPI events

SYNOPSIS

acpid [OPTIONS]

PARAMETERS

-c, --config-dir <directory>
    Specify the directory for ACPI event configuration files.

-e, --event-file <file>
    (Deprecated) Read events from a specific file (e.g., /proc/acpi/event).

-g, --socket-group <group>
    Set the group ownership for the ACPI event socket.

-l, --log-file <file>
    Direct logging output to a specified file.

-n, --netlink
    Force the use of the netlink interface for event listening.

-s, --socket <file>
    Specify the path to the UNIX domain socket.

-S, --stop
    Send a stop signal to a running acpid instance.

-D, --no-daemon
    Do not fork into the background; run in the foreground.

-h, --help
    Display a help message and exit.

-v, --version
    Display version information and exit.

DESCRIPTION

acpid, the Advanced Configuration and Power Interface event daemon, is a critical component for power management and hardware event handling on Linux systems. Its primary function is to monitor various ACPI events originating from the kernel, such as power button presses, lid closures, battery status changes, or thermal alerts. Upon detecting an event, acpid consults its configuration files, typically located in /etc/acpi/events/, to identify a matching rule. Once a rule is matched, it executes a corresponding script, often /etc/acpi/handler.sh, to perform the desired action (e.g., suspend, hibernate, or log off).

Historically, acpid read events from /proc/acpi/event, but modern implementations leverage the netlink socket interface for more efficient and robust communication with the kernel. This daemon provides a flexible and customizable framework for system administrators and users to define how their Linux system reacts to physical hardware events, ensuring proper power management and a responsive user experience.

CAVEATS

acpid requires kernel ACPI support to function. Its effectiveness heavily depends on the correct configuration of event rules and handler scripts in /etc/acpi/. Misconfigured scripts can lead to unintended power actions or system instability. While acpid handles many hardware events, modern desktop environments and systemd-logind may handle certain common events (like lid closure or power button) natively, potentially overriding or working in conjunction with acpid's configurations.

CONFIGURATION FILES AND EVENT HANDLING

acpid's behavior is primarily defined by two types of files within the /etc/acpi/ directory:
Event Configuration Files: Found in /etc/acpi/events/, these files contain regular expressions that acpid uses to match incoming ACPI event strings. Each file typically specifies a single event pattern and the action (a script) to execute when that pattern is matched.
Event Handler Script: The central handler is often /etc/acpi/handler.sh, which receives the detected event as arguments and dispatches to specific functions or scripts based on the event type (e.g., button/power, button/lid, ac_adapter, battery, thermal). This script provides the logic for how the system reacts to the matched events.

HISTORY

acpid emerged as the standard daemon for handling Advanced Configuration and Power Interface (ACPI) events in Linux, effectively replacing the older Advanced Power Management (APM) system. Its initial implementations primarily relied on polling the /proc/acpi/event file provided by the kernel to receive event notifications. Over time, as Linux kernel development progressed, acpid transitioned to utilizing the more efficient and robust netlink socket interface for event communication, which is the default method on modern systems. While its core function remains consistent, its integration with the broader Linux ecosystem, particularly with the advent of systemd and systemd-logind, has seen some responsibilities for basic power actions shift, though acpid remains crucial for custom or complex ACPI event handling.

SEE ALSO

acpi_listen(8), systemd-logind(8), pm-suspend(8), pm-hibernate(8), udev(7)

Copied to clipboard