When I press the power button a dialog opens, but I want to shutdown the system without receiving "Do you really really want to shutdown?". How can I choose a direct shutdown action on a pressed power button?

I had the same problem with the 11.04 version, but I don't remember the solution and yesterday I upgraded to Ubuntu 11.10.

9 Answers 9


Lid Close Action

To set up the Laptop Lid Close Action you have to install Advanced Setting (or the Gnome Tweak Tool). It is in the USC (Ubuntu Software Center) under either tweak or Advanced Settings. If installed press the super button and type in tweak or advanced and choose the Advanced Settings. When it opens choose the shell tab;

Advanced Settings Before

Press the arrows and choose you desired on both on AC and on battery;

Advanced Setting After

Default buttons behavior

Install dconf-tools:

sudo apt-get install dconf-tools

Press alt+f2 and open dconf-editor (or in a terminal type dconf-editor)

Navigate to org.gnome.settings-daemon.plugins.power and set your default button-power action there:

enter image description here

On some systems you will also need to mark the item suppress-logout-restart-shutdown.

  • 2
    This would be a solution... for Ubuntu 11.04. He's talking about Ubuntu 11.10.
    – RobinJ
    Commented Oct 15, 2011 at 10:05
  • 1
    the answer is "fixed", its not a bug, its a "feature". Commented Oct 15, 2011 at 10:45
  • 4
    I am really wondering if this means userfriendly if you need to install some app and change reg-files to make something trivial like that working.
    – n3rd
    Commented Nov 1, 2011 at 18:57
  • 2
    You can also use command lines for that, gsettings will do the job just fine. Its something that will be fixed soon I hope. Def not user friendly ;) Commented Nov 1, 2011 at 19:05
  • 1
    The GNOME team has now decided that the shutdown option is "too destructive". Beware of upgrading to later versions of GNOME.
    – palswim
    Commented Mar 17, 2016 at 6:23

I'm afraid that the first answers didn't work for me, I think that the 'graphical solutions' only work for the upper right indicator, not for the power button. rulet solution works for me, I think I can improve it and make the prompt completely disappear. Instead of creating a new file you can use existing /etc/acpi/events/powerbtn file

sudo -H gedit /etc/acpi/events/powerbtn

Add # to comment line:


Add a new line:


Save file. Open a console and type:

sudo acpid restart

That works for me AND the prompt has gone, just like in ubuntu 11.04. Wish this helps.

  • Thanks I've been looking all over the place for an answer to this. All the other stuff about gsettings doesn't work for me on 12.04 with gnome shell.
    – frankster
    Commented Oct 23, 2012 at 18:53
  • Yes! This is also the only thing that worked for me in Ubuntu 12.04. Thank you very much. Commented Mar 31, 2013 at 13:41
  • Yes, this works on Ubuntu 13.04. Other answers involving gsettings do not work (I guess, any more).
    – farfareast
    Commented Jun 16, 2013 at 19:56
  • 1
    This worked for me on Ubuntu 12.04 but to disable the prompt I had to set button-power option in org.gnome.settings-daemon.plugins.power in dconf-editor to nothing. Commented Jul 31, 2013 at 16:26
  • Worked for me on Xubuntu 16.04. Did not want to install any additional apps as first solution mentioned.
    – DjBacon
    Commented Jul 11, 2016 at 13:27

This is the quick, simple answer I needed:

gsettings set org.gnome.settings-daemon.plugins.power button-power 'hibernate'

If you want to see your settings first, try this:

gsettings get org.gnome.settings-daemon.plugins.power button-power

Or maybe this if you want to see all the power settings:

gsettings list-recursively org.gnome.settings-daemon.plugins.power
  • Thanks exactly what I was looking for on Ubuntu 11.10: gsettings set org.gnome.settings-daemon.plugins.power button-power 'suspend'
    – c0de
    Commented Dec 3, 2011 at 11:05
  • 3
    To revert this change use: gsettings set org.gnome.settings-daemon.plugins.power button-power 'interactive'
    – c0de
    Commented Jul 29, 2013 at 9:39
  • Shouldn't it be gsettings set org.gnome.settings-daemon.plugins.power button-power 'shutdown' for non-interactive shutdown? It doesn't work for me, on 16.04, while the graphical solution with installing dconf-editor does. Commented Apr 22, 2016 at 19:25
  • to check that specific trigger press >$gsettings get org.gnome.settings-daemon.plugins.power Commented Feb 11, 2017 at 9:34
  • @Pav I think the 'get' option didn't work for me correctly in 2011. It works in 16.10, so I added it to the answer. Thanks!
    – Phil Hord
    Commented Feb 14, 2017 at 20:31

I wanted to change the power button to suspend-to-RAM. On a Ubuntu 14.04 server (no Gnome/X), changing /etc/acpi/events/powerbtn to use an alternate action (/usr/sbin/pm-suspend) did not work.

Instead, adding a single line to /etc/systemd/logind.conf was enough to do the trick:


Now, pressing the power button causes instant suspend.

  • 1
    This is the only thing that worked for me (Ubuntu 14.04, Xmonad)
    – Andrew
    Commented Jul 28, 2015 at 22:24
  • Odd, this did not work for me on Ubuntu 14.04 LTS just now. dconf-editor solution worked for me. Commented Feb 15, 2016 at 2:56
  • 1
    Worked for me on 16.04.1
    – mcchots
    Commented Jan 5, 2017 at 17:12
  • This was also the only thing that worked for me with Ubuntu 16.04 and awesome window manager. Commented Aug 10, 2017 at 2:27
  • Did not work from me, with Ubuntu 16.04.3 (neither from fluxbox nor from tty1)
    – josinalvo
    Commented Dec 13, 2017 at 17:52

Bruno's answer is only half-correct.

After installing dconf, you should navigate to apps>indicator-session

Place a check mark for the item "suppress-logout-restart-shutdown."

This will work for Unity in Ubuntu 11.10 but not for Gnome 3 or Gnome Classic.

  • 1
    Your answer or the other answer will work in 11.10 but not Gnome3 or Classic?
    – belacqua
    Commented Oct 22, 2011 at 2:15
  • Interestingly, I observe that this only affects the dialog popup when using the indicator in the uppper right. Pressing the power button still shows the dialog.
    – Christoph
    Commented Nov 21, 2011 at 8:42

That didn't work for me in unity or gnome-shell(prompt was always shown). So I've used this manual

from arch linux wiki. I've created file /etc/acpi/events/power with the content:

event=button/power (PWR.||PBTN)

and executed a command:

sudo acpid restart (don't know exactly if it's right command)

And then by pressing hardware power-button computer shotdowns(the prompt will be shown, but that won't stop shutdown process).

  • 1
    That is more helpful for headless command-line-only systems.
    – BBK
    Commented Aug 28, 2012 at 16:02
  • 1
    That is helpful for any type of systems.
    – rulet
    Commented Jan 13, 2013 at 2:14
  • wow, I went through every other answer above and this is the only one that actually worked. I'm on Ubuntu 20.04
    – philn
    Commented Aug 24, 2022 at 21:33

For current Ubuntu and Lubuntu systems:

echo "HandlePowerKey=suspend" | sudo tee -a /etc/systemd/logind.conf
sudo service systemd-logind suspend

For me the solution was was this:

gsettings set org.gnome.settings-daemon.plugins.power power-button-action suspend
  • 1
    Probably OK for standard Ubuntu using Gnome Shell, but the question was asked nine years ago and thus related to the Unity desktop.This may have changed in the mean time.
    – vanadium
    Commented Sep 8, 2018 at 13:31
  • 1
    @vanadium gsettings attributes have been almost the same I think. Regardless of that, this question shows up in Google Search as the first one so this answer might be useful for someone. Commented Sep 8, 2018 at 13:35

None of this worked on my 13.04 system. In the end I re-compiled gnome-session.

In gsm_shell.c and gsm_logout_dialog.c change #define AUTOMATIC_ACTION_TIMEOUT from 60 to 5

You must log in to answer this question.

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