I have a headless linux mint machine that I use for a file server and other things. It's been working great for me for a few years, but there's one issue - my cat likes to hang out on top of it, and when she climbs off and on she occasionally steps on the power button and shuts off the machine.

Is there an easy way to change the behavior of the power button so it requires an extremely long duration press (10 seconds or so) or multiple presses in order to do anything?

  • Is this a desktop or a laptop? I'm guessing laptop if that cat has access to the power button.
    – terdon
    Jan 10, 2014 at 17:45
  • 3
    It's a desktop - is this actually relevant to a software solution? Jan 10, 2014 at 22:16
  • Heh. Not only do I have the the same problem, it's for exactly the same reason. To @terdon's question, it's a desktop, but the power button is on the top of the front panel facing up. It's in just the right place for a cat to put a paw on when jumping off the top of the case.
    – Sam Hanes
    Mar 28, 2016 at 20:42
  • 3
    If you have a reset button, it's often smaller and harder to press. If so, you can wire it up as the power button, and disconnect the actual power button. That's how I deal with my cat related power button issues :)
    – Roger Dahl
    Jun 9, 2016 at 3:14
  • 1
    Same problem, but with my kids accidently pressing the power button… :-) Sep 29, 2017 at 7:53

4 Answers 4


Well, one thing you could do is simply disable the power button altogether. Personally, I only use it to turn on my machine, and never use it once the machine is on. If this is an OK solution for you, edit /etc/acpi/events/powerbtn-acpi-support:

sudo nano /etc/acpi/events/powerbtn-acpi-support

That file should look something like this:

event=button[ /]power

To make the power button do nothing, change it to:

event=button[ /]power

Then restart the acpi daemon with

sudo service acpid restart

Your power button should now be ignored.

  • I'm not really comfortable disabling the button entirely as, since it's a headless machine, if sshd were to crash or something along those lines my only recourse would be to cut off power to the machine. I'd much rather still leave myself with the ability to shut down gracefully if possible. Jan 10, 2014 at 22:20
  • 1
    @schizodactyl on my laptop, the solution above disables only the single press of the power button. A long press will still shut the machine down (though not very gracefully). I don't have access to a desktop at the moment so I can't test how it would work but, presumably, it will do the same. You can also map a shortcut to the shutdown command if you have a keyboard attached.
    – terdon
    Jan 11, 2014 at 2:28
  • 2
    Thank you very much! My kitten used to power off my computer! :) Dec 22, 2014 at 10:22

terdon's answer is correct in most cases, but for distributions that have adopted systemd-logind it handles power events instead of acpid. On those distributions, add or edit this setting /etc/systemd/logind.conf to disable the power button:


To pick up the new setting, restart logind with

sudo systemctl restart systemd-logind

On some older distributions logind can't be restarted while a desktop session is active, in which case you'll need to reboot in order to pick up the new setting.

  • 4
    It looks like it's the working solution for ubuntu 14.04 when you're not using gnome (i3wm in my case).
    – Greg
    Sep 19, 2017 at 4:55
  • I also had to set PowerKeyIgnoreInhibited=yes or switch off the power-handling of my DE (gnome-settings). Both solutions helped to make Gnome ignore the power-button too.
    – berkes
    May 6, 2019 at 12:58
  • This worked a treat for my MacBook Air running Debian Stretch. The power button is just way too close to backspace. Aug 24, 2019 at 0:36
  • 2
    It's actually both. The ACPI system still works, but cedes control to logind if it's detected. That actually makes this solution better because if logind is failing, you probably want the power button to do a proper shutdown by default.
    – Walf
    Oct 11, 2019 at 1:10

Duct-tape a cardboard guard over the button. Take three pieces of corrugated cardboard, and cut a hole in each large enough for your finger to reach through to the button. Glue them together, with the hole aligned, then duct tape the assembly around the button. All hail our feline overlords!


First you could edit your keymap file to change the behavior of the power button to assign it to an other key

Edit the file : /usr/share/X11/xkb/symbols/inet (edit POWR key)

Then you will need to disable the power button efficiently a good method is with xinput

run xinput --list power buttons have their own entry... pick the device number then run

xinput disable devnumber something like xinput disable 8

You must log in to answer this question.

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