I run Fedora on a Dell server box which has the power button in a dumb location where it is easily pressed accidentally. The button is very close to the DVD drive open button! And worse, the activation pressure is extremely light. I think somebody at Dell needs to be fired…
I do have Workstation installed but I have removed quite a lot of it. So I don’t have the normal GUI management tools, when I do upgrades to new releases I use command line etc.
I didn’t find how to search docs.fedoraproject.org, I don’t see a search box!
I’m unable to find how to configure the power button not to do anything, can somebody please point me in the right direction?
Have a look to the
HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=, HandleLidSwitchExternalPower=,
Controls how logind shall handle the system power, reboot and sleep keys and the lid switch to trigger actions such as
system power-off, reboot or suspend. Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend",
"hibernate", "hybrid-sleep", "suspend-then-hibernate", and "lock". If "ignore", logind will never handle these keys. If
"lock", all running sessions will be screen-locked; otherwise, the specified action will be taken in the respective
event. Only input devices with the "power-switch" udev tag will be watched for key/lid switch events. HandlePowerKey=
defaults to "poweroff", HandleRebootKey= defaults to "reboot". HandleSuspendKey= and HandleLidSwitch= default to
"suspend". HandleLidSwitchExternalPower= is completely ignored by default (for backwards compatibility) — an explicit
value must be set before it will be used to determine behaviour. HandleLidSwitchDocked= defaults to "ignore".
HandleHibernateKey= defaults to "hibernate". If the system is inserted in a docking station, or if more than one
display is connected, the action specified by HandleLidSwitchDocked= occurs; if the system is on external power the
action (if any) specified by HandleLidSwitchExternalPower= occurs; otherwise the HandleLidSwitch= action occurs.
A different application may disable logind's handling of system power and sleep keys and the lid switch by taking a
low-level inhibitor lock ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch",
"handle-reboot-switch"). This is most commonly used by graphical desktop environments to take over suspend and
hibernation handling, and to use their own configuration mechanisms. If a low-level inhibitor lock is taken, logind
will not take any action when that key or switch is triggered and the Handle*= settings are irrelevant.
Thank you, @sampsonf
I’ll give it a try when I can reboot the box and I will update this thread.
# Log in as GDM
sudo machinectl shell gdm@ $(type -p bash)
# Run in both GDM and user shells
gsettings set org.gnome.settings-daemon.plugins.power power-button-action "nothing"
GDM - ArchWiki
Thank you @vgaetera I prefer a command-line solution without additional package burden. I will try @sampsonf suggestion which looks encouraging and update this thread.
Looks like machinectl is in systemd-container which I do not have installed.
For people with a minimal installation, if it works, then logind.conf is the right approach.
For people with a normal Workstation install (and maybe server, I don’t know) then your suggestion looks like a good choice.
Changing logind.conf in /etc/systemd to include HandlePowerKey=ignore has solved the problem.
Many thanks to everybody who answered.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.