Is there any resonable reason why the 60 sec delay pops up when I press the shutdown button ?

I press the shutdown button to shutdown, if i want to restart, I just press the "turn on" button when the PC has shut down, that aint hard.

Can I get rid of the delay ? I do not see any reason why it is there ????

  • 1
    Start up and shutdown are hard on hardware, especially the more expensive and more powerful systems so the 'turn on after pc has shut down' is a big no-no on a larger expensive systems. I like the delay anyway on the DEsktop; as if I want an immediate shutdown I just sudo shutdown -h now... (have you noticed you have to add the -h to halt the hardware; to force it off! to avoid accidentally turning it off given the potential $cost on larger systems) – guiverc Jul 12 '18 at 13:00
  • In earlyer Ubuntu's you could remove it by typing this in a terminal "gsettings set com.canonical.indicator.session suppress-logout-restart-shutdown true" But it does not work in 18.04 – Kim Borg Nordsig Jul 12 '18 at 14:35

That's built into Ubuntu as automatic protection just in case you inadvertently press the power button and eg, forgot to save a file. To override this, sudo poweroff gives an immediate response as does sudo reboot (restart).

  • "sudo poweroff" will meen that i have to start a terminal. Just want to shutdown nothing else. I would be ok if the popup came, if ther was open windows or unsavet things, but there isn't. – Kim Borg Nordsig Jul 12 '18 at 14:12
  • 1
    Even in Windows, it's not recommended you shutdown via the power button other than in emergency, else you could corrupt it. I suppose you could flick the PSU switch if you are that intent on immediate shutdown in Ubuntu. But what's wrong with using the standard shutdown procedure? – Paul Benson Jul 12 '18 at 18:22
  • 1
    What's wrong, is just that i have to confirm a task that i just did. When i press the power button i meens that i intend to shut down my computer, not that i need to confirm that i want to shut down.It does not harm the computer, as i shuts down in the exact same way, just like when i confirm i want to shut down. But i have found the solution. In "dconf-editor" i found the setting, that prevents the popup box :-) – Kim Borg Nordsig Jul 15 '18 at 11:16
gsettings set org.mate.session logout-timeout 3

will set the timer to 3 seconds.

  • 1
    That's for MATE, not Gnome. If you didn't specifically install MATE, I don't think this is the solution for you. – LinuxDisciple Mar 13 '20 at 3:59

My solution involves the following steps:

  1. Use dconf-editor or gsettings to stop sending the power-off events to Gnome
  2. Create a custom event handler as outlined in the acpi examples

To turn off event handling by Gnome:

gsettings set org.gnome.settings-daemon.plugins.power button-power nothing
gsettings set org.gnome.settings-daemon.plugins.power power-button-action nothing

Now to create the custom event handler for the power button (do the following as root):

In folder /etc/acpi/events create the event file. I called mine button-power with the following contents:

event=button[ /-]power
action=/etc/acpi/powerbtn.sh "%e"

The bit in braces is regexp for "space, slash or dash". If you're confident your kernel supplies only slashes you can go with the explicit character.

In folder etc/acpi create the script file you referred to above (powerbtn.sh) with the following contents:

/usr/bin/logger "Custom shutdown in response to event $1"
/sbin/shutdown -h now "Custom shutdown: $1"

Either reboot or send your acpid a SIGHUP and your power button will now instantly initiate a controlled shutdown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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