How do I use "virsh shutdown" on KVM domains to shut down Ubuntu guests?
Check to see if you have the package acpid installed on each of the guests.
I generally create new virtual machines using VMBuilder with the parameter --addpkg acpid
and the only time I've had trouble shutting down Ubuntu guests using virsh
was when the guest vm had crashed in some way.
Related videos on Youtube
hheimbuerger
Updated on September 17, 2022Comments
-
hheimbuerger over 1 year
I am using various KVM domains on a Ubuntu server. Both the host and guests run 10.04.1, 2.6.32-24 kernel, virsh reports version 0.7.5, KVM 0.12.3. The guests boot automatically when the host boots and they have
<features><acpi/><features>
in their configuration.I could never manage to make
virsh shutdown MyDomain
on the host to have any effect. It responds withDomain MyDomain is being shutdown
and the domain keeps happily running.virsh list
still lists them in the staterunning
.virsh destroy MyDomain
works fine, but of course that's not really what I want, so most of the time I log into each one and shut them down manually, which is pretty annoying.I couldn't really find any information on how
virsh shutdown
tries to shut the domain down. Pointers to useful bits of documentation are welcome.What could cause this? How is it supposed to work?
-
hheimbuerger over 13 yearsAwesome, that's all it took! I added that to my VMBuilder script as well now. Did I miss an important piece of documentation here, or are you just magically assumed to know that? In retrospect, it makes sense to me, I guess
virsh shutdown
is just the equivalent to pressing the power button on a physical box. But that I haven't seen mentioned anywhere either, or I might have connected the dots and investigated more in that direction... Either way, thanks a lot! (Will upvote when I get the necessary rep.) -
moberley over 13 yearsI know that it is mentioned in the Server Guide section on vmbuilder very close to the end of the article. I'm not aware if it is mentioned elsewhere. help.ubuntu.com/10.04/serverguide/C/jeos-and-vmbuilder.html
-
hheimbuerger over 13 yearsI must have not read it to the end. blush Or maybe I'll just pretend it wasn't there when I originally set most of these VMs up (8.04 or so). :P
-
cbliard over 10 yearsNote for Debian: if you disabled installation of Recommended packages, then
acpid
alone does not much because it only contains the binaries. You need to installacpi-support-base
package to handle power button ACPI events. For Ubuntu,acpid
contains both binaries and base event handlers and is sufficient.