VM won't do autostart - help needed

Michal Privoznik mprivozn at redhat.com
Mon Feb 17 17:22:56 UTC 2020


On 2/16/20 10:20 PM, Yuri Weinstein wrote:
> I used to have QEMU/KVM and Virtual Machine Manager running on ubuntu 
> 16.04 and used to start my VM from crontab as:
> 
> @reboot sleep 30 && virsh start WINDOWS10

Libvirt has an autostart feature, which can start your domain on the 
first time libvirtd is started (i.e. during boot).

virsh autostart WINDOWS10

> 
> After upgrading to ubuntu 18.04 this stopped working, with error:
> 
> error: failed to get domain 'WINDOWS10'
> error: Domain not found: no domain with matching name 'WINDOWS10'
> 
> Running command as "virsh start WINDOWS10" works fine.
> 

This is probably because cron doesn't run the command as root and hence 
the virsh is no longer connecting to 'qemu:///system' but 
'qemu:///session'. Change it to:

virsh -c qemu:///system start WINDOWS10

But I suggest using the autostart feature instead.

> I am trying to use Virtual Machine Manager to autostart my VM and it 
> simply does not work.
> 
> Here is more info on the VM:
> 
> virsh dominfo WINDOWS10
> Id:             2
> Name:           WINDOWS10
> UUID:           32faf348-f54e-445a-90cc-e64d28d9d396
> OS Type:        hvm
> State:          running
> CPU(s):         4
> CPU time:       4846.0s
> Max memory:     8192000 KiB
> Used memory:    8192000 KiB
> Persistent:     yes
> Autostart:      enable
> Managed save:   no
> Security model: apparmor
> Security DOI:   0
> Security label: libvirt-32faf348-f54e-445a-90cc-e64d28d9d396 (enforcing)
> 
> Sounds like a bug to me.
> Any help appreciated.

Michal




More information about the virt-tools-list mailing list