Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like some of my domains to start automatically when my host starts (I'm using libvirt+KVM on ubuntu). I guess I could put some "virsh start..." statements in rc.local, but is there a way to configure this within libvirt/virsh?

share|improve this question
up vote 13 down vote accepted

Looking at the output of "help":

virsh # help autostart
    autostart - autostart a domain

    autostart <domain> [--disable]

    Configure a domain to be automatically started at boot.

    [--domain] <string>  domain name, id or uuid
    --disable        disable autostarting

This requires that you defined the domain from a file (i.e., that the domain is persistent rather than transient).

share|improve this answer

If you get the response:

    virsh autostart domainname
    "cannot set autostart for transient domain"


    virsh shutdown domainname
    virsh define xmlfile
    virsh start domainname
    virsh autostart domainname

In my experience on Ubuntu 12.04, this only happens if a virsh undefine has been run. Domains created with virsh create usually allow setting the autostart immediately after creation.

share|improve this answer

I've also seen this happen when you use "create" instead of "define" for a domain.

For example:

virsh --connect qemu:///system create mytest-vm-20130715.xml

virsh --connect qemu:///system autostart mytest-vm

error: Failed to mark domain mytest-vm as autostarted

error: Requested operation is not valid: cannot set autostart for transient domain

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.