3

When I press the power button, Linux goes to init 0 (or shutdown clean). In the old times (2003) I had to configure acpid to give the shutdown function to the power button. Today on Slackware-current I did:

cat /etc/apci/event/default

#event=button power.*
#action=/sbin/init 0

and I see the function is commented with # which mean disabled. So the question is: which daemon provides the init 0 function when I press the power button? Other distributrion mnay have systemd, but on Slackware we don't have systemd. Is it acpid even though the power button lines are commented?

1
  • 2
    I believe it's still handled by acpid at the lowest level, but the events issued by acpi can be picked up by other software. In addition the fact that the shown config file is comment may simply mean that those are the default values...
    – Pedro
    Commented May 22, 2020 at 11:22

2 Answers 2

2

Solution found. The acpi power button on Slackware, is managed by acpid daemon, is easy to test: I have booted a vm with acpid disabled and when I press the power button nothing happen. The power button init-0-way is configured by default, on old distros I have to edit it manually, now is enabled by default but you can configure /etc/acpi/events/default (or another name by your choose) to configure this "way" in another manor. For example if I want a different message from shutdown command I create a file

vim /etc/acpi/events/myway

with those contents

event=button/power
action=/etc/acpi/button.sh "%e"

and finally I create the script /etc/acpi/button.sh with this content

  /sbin/shutdown -h now "My message"

I restart acpid and work

/etc/rc.c/rc.acpid restart
0

I think with systemd it is now found in /etc/systemd/logind.conf

I only know about Settings - Power - Suspend & Power Button with RHEL/CentOS 7

When the power button is pressed.... suspend, power off, do nothing.

man logind.conf

2
  • 1
    Slackware doesn't had systemd
    – elbarna
    Commented May 22, 2020 at 13:24
  • look under /etc/acpi maybe if it's INIT based. I forgot everything init when I started using RHEL 7.
    – ron
    Commented May 22, 2020 at 13:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .