acpid(8)
โจ NAME โจ
acpid โ Advanced Configuration and Power Interface event daemon ๐
okay so real quick, before anything else: this is the acpid manual page, like from the System Manager's Manual, and we're about to go through every single bit of it together. grab a snack. ๐
๐ธ SYNOPSIS ๐ธ
acpid [options]
๐ฆ DESCRIPTION ๐ฆ
So acpid is literally designed to notify user-space programs about ACPI events. That's the whole job. ๐
It should be started during system boot, and by default it runs as a background process. It opens an events file (/proc/acpi/event by default) and tries to read whole lines, each line being an ACPI event. If that events file doesn't exist, acpid will try to connect to the Linux kernel through the input layer and netlink instead. Either way, when an ACPI event comes in from one of these sources, acpid looks at its list of rules and executes the ones that match. ๐
heads up bestie:acpidwill ignore all incoming ACPI events if a lock file exists (/var/lock/acpidby default). lock file present = no events, no cap. ๐ฅ
Rules are defined by simple configuration files. acpid looks in a configuration directory (/etc/acpi/events by default) and parses all regular files whose names consist entirely of upper and lower case letters, digits, underscores, and hyphens (similar to run-parts(8)) that do not begin with a period (.) or end with a tilde (~). ๐
Each file must define two things: an event and an action.
- Any blank lines, or lines where the first character is a hash (
#), are ignored. ๐ - Extraneous lines get flagged as warnings, but they are not fatal. so chill.
- Each line has three tokens: the key, a literal equal sign, and the value.
- The key can be up to 63 characters, and is case-insensitive (but whitespace matters).
- The value can be up to 511 characters, and is case and whitespace sensitive.
The event value is a regular expression (see regcomp(3)), and events get matched against it. โจ
The action value is a commandline, which will be invoked via /bin/sh whenever an event matching that rule happens. The commandline may include shell-special characters, and they will be preserved. The only special characters in an action value are % escaped. ๐ฅ
- The string
%ewill be replaced by the literal text of the event for which the action was invoked. This string may contain spaces, so the commandline must take care to quote the%eif it wants a single token. ๐ญ - The string
%%will be replaced by a literal%. - All other
%escapes are reserved, and will cause a rule to not load. ๐
This feature allows multiple rules to be defined for the same event (though no ordering is guaranteed), as well as one rule to be defined for multiple events. To force acpid to reload the rule configuration, send it a SIGHUP. ๐ซถ
The pseudo-action <drop> causes the event to be dropped completely and no further processing undertaken; clients connecting via the UNIX domain socket (see below) will not be notified of the event. This may be useful on some machines, such as certain laptops which generate spurious battery events at frequent intervals. The name of this pseudo-action may be redefined with a commandline option. ๐
In addition to rule files, acpid also accepts connections on a UNIX domain socket (/var/run/acpid.socket by default). Any application may connect to this socket. Once connected, acpid will send the text of all ACPI events to the client. The client has the responsibility of filtering for messages about which it cares. acpid will not close the client socket except in the case of a SIGHUP or acpid exiting. ๐
For faster startup, this socket can be passed in as stdin so that acpid need not create the socket. In addition, if a socket is passed in as stdin, acpid will not daemonize. It will be run in foreground. This behavior is provided to support systemd(1). โญ
acpid will log all of its activities, as well as the stdout and stderr of any actions, to syslog. ๐
All the default files and directories can be changed with commandline options. periodt.
๐ OPTIONS ๐
-c,--confdir_directory_ โ changes the directory whereacpidlooks for rule configuration files. Default is/etc/acpi/events. ๐-C,--clientmax_number_ โ changes the maximum number of non-root socket connections that can be made to theacpidsocket. Default is256. โจ-d,--debugโ bumps theacpiddebug level up by one. ๐-e,--eventfile_filename_ โ changes the event file thatacpidreads events from. Default is/proc/acpi/event. ๐ฆ-n,--netlinkโ forcesacpidto use the Linux kernel input layer and netlink interface for ACPI events. ๐ฅ-f,--foregroundโ keepsacpidin the foreground by not forking at startup, and makes it log to stderr instead of syslog. ๐-l,--logeventsโ tellsacpidto log information about all events and actions. ๐-L,--lockfile_filename_ โ changes the lock file used to stop event processing. Default is/var/lock/acpid. ๐-g,--socketgroup_groupname_ โ changes the group ownership of the UNIX domain socket thatacpidpublishes events to. ๐ซถ-m,--socketmode_mode_ โ changes the permissions of the UNIX domain socket thatacpidpublishes events to. Default is0666. ๐-s,--socketfile_filename_ โ changes the name of the UNIX domain socket thatacpidopens. Default is/var/run/acpid.socket. ๐ธ-S,--nosocketโ tellsacpidnot to open a UNIX domain socket at all. This overrides the-soption, and negates all other socket options. ๐-p,--pidfile_filename_ โ tellsacpidto use the specified file as its pidfile. If the file exists, it will be removed and overwritten. Default is/var/run/acpid.pid. ๐-r,--dropaction_action_ โ defines the pseudo-action which tellsacpidto abort all processing of an event, including client notifications. Default is<drop>. ๐-t,--tpmutefixโ enables special handling of the mute button for certain ThinkPad models with mute LEDs that get out of sync with the mute state when the mute button is held down. With this option, the mute button will generate the following events in sync with the number of presses (and, by extension, the state of the LED): ๐ง
button/mute MUTE (key pressed) K
button/mute MUTE (key released) K
-v,--versionโ print version information and exit. โญ-h,--helpโ show help and exit. ๐
๐ EXAMPLE ๐
This example will shut down your system if you press the power button. (dramatic? yes. useful? also yes. ๐ฅ)
Create a file named /etc/acpi/events/power that contains the following:
event=button/power
action=/etc/acpi/power.sh "%e"
Then create a file named /etc/acpi/power.sh that contains the following:
/sbin/shutdown -h now "Power button pressed"
Now, when acpid is running, a press of the power button will cause the rule in /etc/acpi/events/power to trigger the script in /etc/acpi/power.sh. The script will then shut down the system. ๐
slay.
๐ TROUBLESHOOTING ๐
acpid is a simple program that runs scripts in response to ACPI events from the kernel. When there's trouble, the problem is rarely with acpid itself. The following are some suggestions for finding the most common sources of ACPI-related problems. ๐ซถ
When troubleshooting acpid, it is important to be aware that other parts of a system might be handling ACPI events. systemd(1) is capable of handling the power switch and various other events that are commonly handled by acpid. See the description of HandlePowerKey in logind.conf(5) for more. Some window managers also take over acpid's normal handling of the power button and other events. ๐ญ
kacpimon(8) can be used to verify that the expected ACPI events are coming in. See the man page for kacpimon(8) for the proper procedure. If the events aren't coming in, you've probably got a kernel driver issue. ๐
If the expected events are coming in, then you'll need to check and see if your window manager is responsible for handling these events. Some are, some aren't. (E.g. in Ubuntu 14.04 (Unity/GNOME), there are settings for the laptop lid in the System Settings > Power > "When the lid is closed" fields.) If your window manager is responsible for handling the problematic event, and you've got it configured properly, then you may have a window manager issue. ๐
Lastly, take a look in /etc/acpi/events (see above). Is there a configuration file in there for the event in question (e.g. /etc/acpi/events/lidbtn for laptop lid open/close events)? Is it properly connected to a script (e.g. /etc/acpi/lid.sh)? Is that script working? It's not unusual for an acpid script to check and see if there is a window manager running, then do nothing if there is. This means it is up to the window manager to handle this event. โจ
๐ง DEPENDENCIES ๐ง
acpid should work on any linux kernel released since 2003. yes bestie, it's been serving for a while. ๐
๐ FILES ๐
/proc/acpi/event/dev/input/event*/etc/acpi//var/run/acpid.socket/var/run/acpid.pid/var/lock/acpid
๐ BUGS ๐
There are no known bugs. To file bug reports, see PROJECT WEBSITE below. ๐
๐ธ SEE ALSO ๐ธ
regcomp(3) sh(1) socket(2) connect(2) init(1) systemd(1) acpi_listen(8) kacpimon(8)
๐ฅ PROJECT WEBSITE ๐ฅ
http://sourceforge.net/projects/acpid2/
๐ AUTHORS ๐
- Ted Felix
<ted@tedfelix.com> - Tim Hockin
<thockin@hockin.org> - Andrew Henroid
and that's the whole page bestie ๐ this was the acpid(8) page from the System Manager's Manual โ no version or date printed down here, just the classic acpid(8) footer tag, so consider this your cute little sign-off. go forth and handle those ACPI events, you've got this. ๐ฆโจ๐
๐ฆ where this page comes from
- alpine 3.22: acpid-doc 2.0.34-r6 ยท GPL-2.0-or-later
- alpine 3.23: acpid-doc 2.0.34-r7 ยท GPL-2.0-or-later
- alpine 3.24: acpid-doc 2.0.34-r8 ยท GPL-2.0-or-later
- arch rolling: acpid 2.0.34-2 ยท GPL
- centos-stream 10: acpid 2.0.34-10.el10 ยท GPL-2.0-or-later
- centos-stream 9: acpid 2.0.32-7.el9 ยท GPLv2+
- debian bookworm: acpid 1:2.0.33-2+b1 ยท GPL-2.0-only
- debian trixie: acpid 1:2.0.34-1+b1 ยท GPL-2.0-only
- fedora 43: acpid 2.0.34-14.fc43 ยท GPL-2.0-or-later
- fedora 44: acpid 2.0.34-16.fc44 ยท GPL-2.0-or-later
- nixos 26.05: acpid 2.0.34
- nixpkgs unstable: acpid 2.0.34
- opensuse-leap 16.0: acpid 2.0.34-bp160.1.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: acpid 2.0.34-bp160.1.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: acpid 2.0.34-bp160.1.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: acpid 2.0.34-bp160.1.1 ยท GPL-2.0-or-later
- ubuntu jammy: acpid 1:2.0.33-1ubuntu1 ยท GPL-2.0-only
- ubuntu noble: acpid 1:2.0.34-1ubuntu2 ยท GPL-2.0-only
- ubuntu resolute: acpid 1:2.0.34-1ubuntu3 ยท GPL-2.0-only
- ubuntu stonking: acpid 1:2.0.34-1ubuntu3 ยท GPL-2.0-only
- Copyright (c) 2001 Sun Microsystems
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms