1

I am using Ubuntu Server 20.04.6 LTS over ssh. My packages are updated. If there is any other config info that would help, let me know.

I have been trying for hours to get my power button to shut off my server. I started by checking journalctl for systemd-logind. Systemd-logind does report "Power key pressed." when I press my power button. I read that you should set HandlePowerKey=poweroff in the /etc/systemd/logind.conf file. I did not have that file so I created it and added that line.

The file is:

[Login]
HandlePowerKey=poweroff

I restarted the systemd-logind service and pressed the power key but it still did not shut down the system. I have tried after rebooting as well. I do not have acpid installed.

This server has been in use for a year or so now. When I first started playing around with it, the power button did work, so something I did many months ago must have broken that functionality.

I did a little more digging and upon checking systemd-inhibit --list, it appears that gdm is blocking hardware key presses. I'm not sure what exactly gdm is, but is it something I can change/remove?

1 Answer 1

0

To fix my issue, I removed gdm3.

sudo apt remove --purge --autoremove gdm3

My power button now shuts the server off as expected.

I'm guessing I installed gdm3 as a dependency for something, but as it is Gui related, it's not necessary for a server I only ever connect to through ssh.

I wouldn't recommend blindly following what I've done to fix it as I only have a slight idea what Im doing. Do so at your own risk.

1
  • 1
    Your server was probably all the time started in GUI mode and when someone pressed the power button, the GUI might have asked for confirmation, which it never got and so it did not shutdown.
    – paladin
    Commented Feb 17 at 18:10

You must log in to answer this question.

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