Ran into an issue last night with one of my KVM VMs not registering a shutdown command from the host server.
This typically happens because the guest isn’t listening (or is configured to ignore) ACPI power “button” presses, so the guest doesn’t get told that it should shutdown.
In the case of my CentOS (RHEL) 5 VM, the acpid daemon wasn’t installed/running so the ACPI events were being ignored and the VM would just stay running. :-(
To install, start and configure to run at boot:
# yum install -y acpid # /etc/init.d/acpid start # chkconfig --level 345 acpid on
If acpid wasn’t originally running, it appears that HAL daemon can grab control of the /proc/acpi/event file and you may end up with the following error upon starting acpid:
Starting acpi daemon: acpid: can't open /proc/acpi/event: Device or resource bus
The reason can quickly be established with a ps aux:
[root@basestar ~]# ps aux | grep acpi root 17 0.0 0.0 0 0 ? S< 03:16 0:00 [kacpid] 68 2121 0.0 0.3 2108 812 ? S 03:18 0:00 hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event root 3916 0.0 0.2 5136 704 pts/0 S+ 03:24 0:00 grep acpi
Turns out HAL grabs the proc file for itself if acpid isn’t running, but if acpid is running, it will talk to acpid to get it’s information. This would self-correct on a reboot, but we can just do:
# /etc/init.d/haldaemon stop # /etc/init.d/acpid start # /etc/init.d/haldaemon start
And sorted:
[root@basestar ~]# ps aux | grep acpi root 17 0.0 0.0 0 0 ? S< 03:16 0:00 [kacpid] root 3985 0.0 0.2 1760 544 ? Ss 03:24 0:00 /usr/sbin/acpid 68 4014 0.0 0.3 2108 808 ? S 03:24 0:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket root 16500 0.0 0.2 5136 704 pts/0 S+ 13:24 0:00 grep acpi