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
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”
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.
Still works! Very useful indeed. As Esselo commented, ideal for keeping young fingers from wreaking havoc.
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:) !
any idea how to disable power button on debian squeeze ?
its seems that powerbutton.sh is no longer on /etc/acpi
Wow!! GREAT!! Very thx. This work in Debian Wheezy :)
(Conflict with gnome settings daemon, in gnome 3.2 :P )
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
How do you do this in Ubuntu 10.04? Doesn’t work..
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
I’m glad to hear that it helped you (and you cat ;) and that it’s still useful for Wheezy.