Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to disable the power button of my laptop. It happens that sometimes I press it by mistake and my work goes.

It'd be optimal for me to make this button inoffensive, e.g. nothing happens pressing it.

How I do that in Ubuntu 12.04?

Actually if I press the button this popup appears:

enter image description here

enter image description here

share|improve this question
up vote 5 down vote accepted

Run the following commands in Terminal to disable the power button:

sudo sed -i 's/action=/#action=/g' /etc/acpi/events/powerbtn
sudo gsettings set org.gnome.settings-daemon.plugins.power button-power nothing

Note: this will result in syslog logging the following message: skipping incomplete file /etc/acpi/events/powerbtn.

Reboot your computer, and try hitting the power button!

Voilà :)

Click here for a user's detailed analysis of the underlying mechanisms that are triggered when someone hits the power button.

share|improve this answer
For a moment I was impressed! Then I tried and did the reboot, but the shutdown popup keep showing (see my updated question). – Paolo Sep 27 '12 at 19:01
@Guandalino Try again with my edit. – SirCharlo Sep 27 '12 at 19:08
Still nothing. I'll gladly accept any further suggestion! – Paolo Sep 27 '12 at 19:16
@Guandalino So it worked after all? – SirCharlo Sep 27 '12 at 19:48
Yes! I followed the thread on Ubuntu forum post by post and it did the trick. PS: I'm not sure it's safe commenting the action line in /etc/acpi/events/powerbtn. It results in this syslog message: skipping incomplete file /etc/acpi/events/powerbtn. Maybe say that in your answer. I leaved it uncommented. – Paolo Sep 27 '12 at 20:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.