My NUC runs Debian Bullseye without a monitor. Can I set it up so one short press of the power button shuts it down safely? A long press seems to cut the power.
Can I make a short power button press safely shut down my headless NUC?
Answers
On Debian, systemd-logind can handle the power button. Edit /etc/systemd/logind.conf and set HandlePowerKey=poweroff. If the line starts with #, remove the # so the setting takes effect.
Then run systemctl restart systemd-logind, or reboot. A short press should initiate a normal shutdown, provided the NUC sends a power button event to Debian. Give it time to finish rather than holding the button down.
Reply to this answer
If SSH is available, you can also connect from another machine and run a shutdown command. That's handy for remote administration, though it won't replace the button if the network is unavailable during a power outage.
Reply to this answer
I'd check the firmware settings if a short press doesn't do anything after configuring Debian. The operating system can handle the button, but it needs to receive the event from the hardware first.
Reply to this answer
Add your answer
Answers are reviewed before publication.
!tangerine~test+pilot:
If a graphical desktop is running, its power management settings can override logind's button handling.