Disable the power button event in Debian

Don’t know you, but it has already happened to me to shut down a running server by accidently pressing the power button. Linux intercepted the event and quickly started the power down procedure, sadly bringing my infrastructure to its knees.

But not anymore! In Debian it’s really easy to disable this behaviour. All you have to do is edit

/etc/acpi/powerbtn.sh

with your preferred editor and comment out the line

/sbin/shutdown -h now "Power button pressed"

That’s all. Just tested on a Debian 4.0 Etch installation.

10 thoughts on “Disable the power button event in Debian

  1. Thanks for this tip! My daughter likes the power button very much, which is kind of bad if you try to get some work done… I already configured my Windows XP so that it will only show the power down options instead of instantly powering off when the power key is hit. Now I could do the same for my Debian.

  2. Still works! Very useful indeed. As Esselo commented, ideal for keeping young fingers from wreaking havoc.

  3. Still works, but if i have completly disable this event in any desktop environment, -such as Gnome or KDE, etc.- simply edit this file and insert one line contains “exit” before another commands.

    Sorry for my (very) bad english:) !

  4. Hi Vide..

    any idea how to disable power button on debian squeeze ?
    its seems that powerbutton.sh is no longer on /etc/acpi

    • In gnome 3 install dconf-tools and run dconf-editor. Go to org/gnome/settings-daemon/plugins/power/button-power and choose “nothing” from left-click menu

  5. Thank you! Even though this was meant for Debian 4, it still works on Debian 7. My cat kept stepping on my keyboard and shutting me down while I was working.
    PS: The file name has changed to /etc/acpi/powerbtn-acpi-support.sh

Leave a reply to Vide Cancel reply