Blog about software development


Disable power button on Ubuntu server

30 Dec 2021 - by 'Maurits van der Schee'

My youngest son loves to play with my PC's shiny LED-lit power button, which is annoying at times. In Xubuntu XFCE's "Power Manager" allows you to change the behavior of the power button from "Ask" to "Do nothing". I also have a (headless) Ubuntu 20.04 LTS Server that runs my virtual machines (using KVM). I don't want the power button to work on that machine either. I had some trouble finding the right setting in my web searches as Ubuntu server's power button is managed by Systemd.

Disable power button

Ubuntu 20.04 LTS Server uses systemd. This also means the power button behavior is not managed by "acpid", but by "systemd-logind". In the man pages of "systemd-logind" we find that:

systemd-logind is a system service that manages user logins. It is responsible for: (...) Handling of power/sleep hardware keys. - (source)

This service has a config file in "/etc/systemd/logind.conf" that has the line:


You need to change that to:


In order to make this change effective (no reboot needed), you run:

sudo systemctl restart systemd-logind.service

Now you can take the chance and try to touch the power button (fingers crossed).


PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.