3

Platform: Intel NUC NUC5CPYH

OS: Centos 7 with 3.10.0-327.22.2.el7.x86_64

When I press the chassis power button, the system goes in to suspend mode instead of the expected poweroff. This seems pretty simple and is the default action from logind

grep Power /etc/systemd/logind.conf
#HandlePowerKey=poweroff
#PowerKeyIgnoreInhibited=no

But when I push the power button, I see this in the logs

Aug  6 15:33:45 localhost systemd-logind: Power key pressed.
Aug  6 15:33:50 localhost systemd-logind: Delay lock is active (UID 1000/testuser, PID 1762/gnome-shell) but inhibitor timeout is reached.
Aug  6 15:33:50 localhost systemd: Reached target Sleep.
Aug  6 15:33:50 localhost systemd: Starting Sleep.
Aug  6 15:33:50 localhost systemd: Starting Suspend...
Aug  6 15:33:50 localhost systemd-sleep: Suspending system...

I've tried setting debug level logging on systemd and logind, but didn't get any more information.

Why does the "poweroff" action end up at the Sleep target?

2

1 Answer 1

3

@maxschlepzig - systemctl start poweroff.target sucessfully powers down the machine. I didn't try changingHandlePowerKey=poweroff because I was also looking at gnome settings.

@don_crissti - I was so focused on the systemd angle that I didn't even think of gnome being part of the process. You're correct, this is a duplicate questions of Gnome 3: how to set power button to shutdown instead of suspend? . The accepted answer there is to patch and rebuild gnome-settings-daemon.

Before attempting that patch, I looked at

$ gsettings get org.gnome.settings-daemon.plugins.power button-power 'suspend'

and suspend is what it was doing, but not what I wanted. Looking at the possible values for the button-power key

$ gsettings range org.gnome.settings-daemon.plugins.power button-power enum 'blank' 'suspend' 'shutdown' 'hibernate' 'interactive' 'nothing' 'logout'

Since shutdown is what I wanted to do, I updated that key

gsettings set org.gnome.settings-daemon.plugins.power button-power shutdown

Now the power button will cleanly shutdown the machine.

Not being much of a Gnome expert, is there a better way to do this?

1
  • The only downside is to wait 60 seconds until the power off (which is, until now, not customizable). Oct 20, 2019 at 19:28

You must log in to answer this question.

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