I want to be able to shutdown my CentOS 7 machine by pressing the power button. Since it doesn't work out of the box, I tried the following:
yum -y install acpid
service acpid start
chkconfig acpid on
Unfortunately without effect, probably because this was valid for CentOS 6.x only. Does anyone know how to enable shutdown by pressing the power button?
Best Answer
I had this problem too.
Essentially, what you'll see in your logs (if systemd is configured properly, either method above works--systemd translates the old 'service' commands for you... at least in CentOS7)
So, you then need to cruise on over to /var/log/audit/audit.log and you'll see something like this:
OK, why are system configuration files not in /etc anymore? Anyway, I digress....something about /usr/lib/systemd/system/poweroff.target is off?: BTW, I really like how the new automated files obfuscate themselves now... There is no real direction to go now... this file is completely useless. What do any of these options mean? I'm guessing job security for some PFY-admins... and more overtime for me. (must be another 'feature'!)
OK, at this point, we have enough information to really look for an answer. The problem is an SELinux policy that is preventing systemd from shutting the system down.
Et voila! There is a bug against it: https://bugzilla.redhat.com/show_bug.cgi?id=1224211
Essentially, around comment #60 or so they figure out that there is a policy error. It'll be fixed via regular updates, but I wanted to install only the packages from the 'everything dvd'. So, it looks like I have to wait until 7.2 is released by the CentOS guys to fix this problem!