KVM/QEMU guest not shutting down?

One of my KVM/QEMU guests wasn’t shutting down correctly when the host issued the ACPI shutdown command.
Having checked that the guest’s XML definition included the <acpi/> tag in the <features>…</features> section, and that acpid was installed on the guest and that acpi-tools was installed on the guest, I realised that this was an Ubuntu 14.04 client O/S and therefore that it was doing something other than shutdown when it was told to. I believe that this will only happen on the “client” installs of Ubuntu – installing the server grade Ubuntu will not do this, although I’ve not confirmed this.
Essentially, the problem is that when the ACPI command to shutdown is received, the client version of Ubuntu will notice, and instead of actioning the request, will display a dialogue box on the console to the effect of “What do you really want to do, shutdown, restart, log-off or lock the screen?”. To change this, edit the file /etc/acpi/events/powerbtn (as root) and comment out the line reading:
action=/etc/acpi/powerbtn.sh

add below it the line:

action=/sbin/poweroff

This will instruct the computer to poweroff when the power button ACPI event is received. Like I said, probably only a problem for the non-server versions of Ubuntu. Serves me right for not installing the correct Server OS, I suppose…

Leave a Reply