Hund

How to disable the power button when using elogind

November 30, 2023

My son, who’s currently two years old, loves to press the big shiny button on my computer case. The button, which happens to be the power button, is surrounded with a glowing blue ring, which probably makes it even more irresistible for a kid in his age.

I first tried to cover it with a piece of paper and some tape, but that didn’t work. It probably just made it more annoying for both of us. My second idea was a success though. I was able to disable it in the operating system itself. It took me a few tries (read: reboots), before I figured it out though.

I was trying to solve it via acpid, but I never got it to work. It turns out that if you use elogind, it will steal the power button input and shutdown the computer no matter what. Thank you Zucca on Gentoo forums for that piece of valuable knowledge.

TL;DR

I added HandlePowerKey=ignore to the [Login]-section in the file /etc/elogind/logind.conf. I then restarted elogind using the command # rc-config restart elogind. Zucca wrote that it would restart your session, but it didn’t for me. I don’t know if I had to or not, but I manually logged out and back in again, just in case.

And that’s all. When my son is now pressing the power button on my computer case, it does absolutely nothing! I’m happy, and my son is happy!

Meta

Comments (2)

Use the e-mail form, if you wish to leave feedback for this post. Markdown is supported for comments. [Terms of service]

Hund
#1
December 8, 2023, 11:29

Nader: Without a working power button, it would have been a lot more annoying to start the computer. :)
I thought about that as well, but I then remembered that I have no speakers connected to my computer.
Edit: I don't know why my comments get's sorted first? :/

#2
December 4, 2023, 23:02

I would have just opened the case and disconnected the power button! But since you've done it like this, how about running a script when it's pressed to play a random loud noise? Your son would love it ;)