How do I use "virsh shutdown" on KVM domains to shut down Ubuntu guests?

15,199

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.

Share:
15,199

Related videos on Youtube

hheimbuerger
Author by

hheimbuerger

Updated on September 17, 2022

Comments

  • hheimbuerger
    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 with Domain MyDomain is being shutdown and the domain keeps happily running. virsh list still lists them in the state running.

    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
    hheimbuerger over 13 years
    Awesome, 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
    moberley over 13 years
    I 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
    hheimbuerger over 13 years
    I 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
    cbliard over 10 years
    Note for Debian: if you disabled installation of Recommended packages, then acpid alone does not much because it only contains the binaries. You need to install acpi-support-base package to handle power button ACPI events. For Ubuntu, acpid contains both binaries and base event handlers and is sufficient.