Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Power Button Enabled To Do Shutdown?
Power Button Enabled To Do Shutdown?
Power Button Enabled To Do Shutdown? I know Debiain 9 is configured by default for suspend or hibernate. But I want to do a graceful shutdown. Using Debian 9.1, default GUI. I have tried to enable this under systemd-logind configuration does not work. And I know that apcid is legacy and depreciated. Anyone figure this out?
Current /etc/systemd/logind.conf is as follows:
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%
PowerKeyIgnoreInhibited=no
HandlePowerKey=poweroff
I enabled the PowerKey and PowerKey handle but it does not work apparently. I do see the event invoked in the auth.log, for example:
Aug 16 18:20:56 crazy systemd-logind[1818]: Power key pressed.
Aug 16 18:20:57 crazy systemd-logind[1818]: Power key pressed.
Thanks.
Current /etc/systemd/logind.conf is as follows:
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%
PowerKeyIgnoreInhibited=no
HandlePowerKey=poweroff
I enabled the PowerKey and PowerKey handle but it does not work apparently. I do see the event invoked in the auth.log, for example:
Aug 16 18:20:56 crazy systemd-logind[1818]: Power key pressed.
Aug 16 18:20:57 crazy systemd-logind[1818]: Power key pressed.
Thanks.
Re: Power Button Enabled To Do Shutdown?
Try configuring in your desktop enviroment power manager first.
Re: Power Button Enabled To Do Shutdown?
For Shutdown use
For Reboot use
I added both to my Openbox menu, the one a right click brings up. You should be able to do something similar on all Linux desktops or WMs.
Code: Select all
systemctl poweroff
Code: Select all
systemctl reboot
Re: Power Button Enabled To Do Shutdown?
have you restarted systemd after making changes to the config?shinobi wrote:I enabled the PowerKey and PowerKey handle but it does not work apparently.
i think it is "systemctl daemon-reload" or some such.
- None1975
- df -h | participant
- Posts: 1389
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 45 times
- Been thanked: 66 times
Re: Power Button Enabled To Do Shutdown?
Maybe, better useBulkley wrote:For Shutdown useFor Reboot useCode: Select all
systemctl poweroff
I added both to my Openbox menu, the one a right click brings up. You should be able to do something similar on all Linux desktops or WMs.Code: Select all
systemctl reboot
Code: Select all
systemctl poweroff -i
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
Re: Power Button Enabled To Do Shutdown?
That is, well, not helpful, because I can't get debian to do what Ubuntu,Windows MacOS, all do out of the box. This system will be HEADLESS and LOCAL KEYBOARDLESS and thus I really need the power button to initiate a power down by the OS.
Linux is frustrated in this regard, there is little consistency across distributions at the hardware level. Again, what makes things more confusing is that EVEN AFTER I disable the hibernate or suspect options in the UI (GNOME) in this case, pushing the power button the system still goes into a suspect state. THAT MAKES NO SENSE.
Someone has to have figured this out, no? How many 1000s or 10,000s or more people use Debian?
Linux is frustrated in this regard, there is little consistency across distributions at the hardware level. Again, what makes things more confusing is that EVEN AFTER I disable the hibernate or suspect options in the UI (GNOME) in this case, pushing the power button the system still goes into a suspect state. THAT MAKES NO SENSE.
Someone has to have figured this out, no? How many 1000s or 10,000s or more people use Debian?
Re: Power Button Enabled To Do Shutdown?
Uhm... as far as I know there has never been a default gui for poweroff. I just searched the repository and found nothing. So could you please indicate exactly what the name of the said package is?
And why on earth are you using such package if you intend to use the machine headless? If there is any such package it will likely ask you to ok the action by clicking on some ok label. What you are saying is extremely confusing, or maybe I am just not understanding what you want.
if what you want is a button or other means to shut down gracefully then why not create a service that send a shutdown signal upon said event?
If you read the manual for logind.conf it says:
Another possible solution you might want to consider is serving a small webserver that offers (locally) a page with buttons like "poweroff" "reboot" etc, in which case you would not even need to have physical access to the button.
I have one headless server where I placed a shutdown systemd service file and it works. However my version shutsdown automatically after a certain time has passed. But I am sure that what you want can be done. It is possible that if you installed some package to handle this (the gui that you talk of) then that is messing up the configuration some how and maybe you should remove it.
And why on earth are you using such package if you intend to use the machine headless? If there is any such package it will likely ask you to ok the action by clicking on some ok label. What you are saying is extremely confusing, or maybe I am just not understanding what you want.
if what you want is a button or other means to shut down gracefully then why not create a service that send a shutdown signal upon said event?
If you read the manual for logind.conf it says:
To me at least, it reads as if you would want to be using the "yes" bit, however in your conf file that you posted in the first post to this thread, you use "no". Why?PowerKeyIgnoreInhibited=, SuspendKeyIgnoreInhibited=, HibernateKeyIgnoreInhibited=, LidSwitchIgnoreInhibited=
Controls whether actions that systemd-logind takes when the power and sleep keys and the lid switch are triggered are subject to high-level inhibitor locks ("shutdown", "sleep", "idle"). Low level inhibitor locks ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch"), are always honored, irrespective of this setting.
These settings take boolean arguments. If "no", the inhibitor locks taken by applications are respected. If "yes", "shutdown", "sleep", and "idle" inhibitor locks are ignored. PowerKeyIgnoreInhibited=, SuspendKeyIgnoreInhibited=, and HibernateKeyIgnoreInhibited= default to "no". LidSwitchIgnoreInhibited= defaults to "yes". This means that when systemd-logind is handling events by itself (no low level inhibitor locks are taken by another application), the lid switch does not respect suspend blockers by default, but the power and sleep keys do.
Another possible solution you might want to consider is serving a small webserver that offers (locally) a page with buttons like "poweroff" "reboot" etc, in which case you would not even need to have physical access to the button.
I have one headless server where I placed a shutdown systemd service file and it works. However my version shutsdown automatically after a certain time has passed. But I am sure that what you want can be done. It is possible that if you installed some package to handle this (the gui that you talk of) then that is messing up the configuration some how and maybe you should remove it.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Power Button Enabled To Do Shutdown?
Can we please see the full output of
I don't think the GNOME developers allow shutdown via a power button:
https://unix.stackexchange.com/question ... of-suspend
Plenty of other desktops (and window managers) available though
Code: Select all
systemd-inhibit
https://unix.stackexchange.com/question ... of-suspend
Plenty of other desktops (and window managers) available though
deadbang
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Power Button Enabled To Do Shutdown?
^:
But maybe you're right, the `systemd-inhibit` output will show for sure anyway.shinobi wrote:Using Debian 9.1, default GUI.
deadbang
Re: Power Button Enabled To Do Shutdown?
^ no, that snark was directed at op.
i just don't see the point in discussing inconsistencies in ui design in linux, then saying that the whole point of the discussion is about being able to poweroff a headless server... which shouldn't be running a gui anyway, imho.
getting rid of the gui, letting systemd handle the power button => benefit.
i just don't see the point in discussing inconsistencies in ui design in linux, then saying that the whole point of the discussion is about being able to poweroff a headless server... which shouldn't be running a gui anyway, imho.
getting rid of the gui, letting systemd handle the power button => benefit.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Power Button Enabled To Do Shutdown?
Maybe it would be better for this OP to just use those ?Post by shinobi » 2017-09-02 21:28
That is, well, not helpful, because I can't get debian to do what Ubuntu,Windows MacOS, all do out of the box. This system will be HEADLESS and LOCAL KEYBOARDLESS and thus I really need the power button to initiate a power down by the OS.
Because Debian is not like the others , fortunately.
No you don't, or you shouldn't need that.I really need the power button to initiate a power down by the OS.
So why can't the OP just access via ssh, and shut it down that way ?
That is what I do.
Re: Power Button Enabled To Do Shutdown?
thanks, garry, for bringing me back down on the ground.GarryRicketson wrote:No you don't, or you shouldn't need that.I really need the power button to initiate a power down by the OS.
So why can't the OP just access via ssh, and shut it down that way ?
That is what I do.
you're absolutely right.
i never touch my server, gui or not. keyboard's way too dusty by now.
come to think of it, i also don't power it off (unless there's a very serious problem).
reboot, yes.
-
- Posts: 1
- Joined: 2017-09-12 16:10
Re: Power Button Enabled To Do Shutdown?
Hi..i am a new user here. As per my knowledge there is little consistency across distributions at the hardware level. What makes things more confusing is that EVEN AFTER I disable the hibernate or suspect options in the UI in this case, pushing the power button the system still goes into a suspect state.
Re: Power Button Enabled To Do Shutdown?
i don't even know what that's supposed to mean.RickyTerzis wrote:As per my knowledge there is little consistency across distributions at the hardware level.
anyhow, you should take the time to formulate your problem description, then search for it, apply what you found, and when that doesn't help, and only then, start your own thread.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Power Button Enabled To Do Shutdown?
I suppose it may vary depending on hardware, on my Desktop, and also
on some laptops, just "pushing" the power button once, and briefly , 1 short "push", will either do a re-boot or just a "sleep" mode, to completely shutdown,
power off, I need to push and hold the button, almost 5 seconds, then it will completely shut-down.
On any remote system, obviously ssh is the only option, but even on a machine
that I have access to, ssh is a good option,... I have had computers that had a damaged switch, the button simply would not work, and no keyboard, ssh is a good option, or simply "pull the plug", not a good method and can cause damage.
on some laptops, just "pushing" the power button once, and briefly , 1 short "push", will either do a re-boot or just a "sleep" mode, to completely shutdown,
power off, I need to push and hold the button, almost 5 seconds, then it will completely shut-down.
On any remote system, obviously ssh is the only option, but even on a machine
that I have access to, ssh is a good option,... I have had computers that had a damaged switch, the button simply would not work, and no keyboard, ssh is a good option, or simply "pull the plug", not a good method and can cause damage.
Re: Power Button Enabled To Do Shutdown?
Right, I found the same behavior, even if I disable suspend in GNOME settings or Tweak Tool or whatever, even from the command-line... nothing actually works correctly. As you found, the power button invokes suspend. What is really frustrating is Windows OS has consistently supported hardware power management, i.e. Power button control for over a decade. And Red Hat OS (RHEL and CentOS) has trapped Ctrl-Alt-Del to invoke Shutdown as well. But the various Linux distributions can't seem to do anything consistently.
Re: Power Button Enabled To Do Shutdown?
another "everything-is-better-on-windows" comment ...shinobi wrote:What is really frustrating is Windows OS has consistently supported hardware power management, i.e. Power button control for over a decade. And Red Hat OS (RHEL and CentOS) has trapped Ctrl-Alt-Del to invoke Shutdown as well. But the various Linux distributions can't seem to do anything consistently.
makes me wonder why they use linux at all, if it's so frustrating.
to me, using windows is very, very frustrating (on the rare occasions i'm forced to use it - surely not at home).
but, i will agree on a general note: "the various Linux distributions" are indeed very diverse. some would consider that a feature, not a bug.