Cannot create VMs.

Bug #1246121 reported by Robert Bruce Park
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Tools used by the Ubuntu QA Team
Fix Released
High
Marc Deslauriers

Bug Description

I was following the instructions at [0] and was not able to produce any VMs. The error messages were highly uninformative, unfortunately:

$ uvt new precise i386 clean
Creating '/home/robru/.machines' directory...
Creating 'clean-precise-i386' VM with:
Memory: 1024
Image size: 8GB
Release: precise - 12.04
Release ISO file: ubuntu-12.04.3-desktop-i386.iso
Pristine snapshot: True
Confirm? [N]|y: y
Clearing out cached iso directory...
Done.
Creating preseeded iso...
Preseeded iso file successfully created: vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso
Problem creating virtual machine 'clean-precise-i386' (doesn't exist). Aborting.

$ uvt new precise i386 clean
'/home/robru/.machines/clean-precise-i386.qcow2' already exists. Aborting.

$ uvt start clean-precise-i386
Sleeping 5 seconds to give 'clean-precise-i386' a chance to start

At this point an error dialog appeared, saying "Cannot find guest domain clean-precise-i386"

Now the system seems to be in this inconsistent state where it can't create the VM because it already exists, but it can't start the VM because it wasn't created correctly.

[0] https://wiki.ubuntu.com/SecurityTeam/TestingEnvironment

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

What's the output of "virsh dumpxml clean-precise-i386"?

Revision history for this message
Robert Bruce Park (robru) wrote :

$ virsh dumpxml clean-precise-i386
error: failed to get domain 'clean-precise-i386'
error: Domain not found: no domain with matching name 'clean-precise-i386'

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

can you please attach /var/log/libvirt/qemu/clean-precise-i386.log?

Revision history for this message
Robert Bruce Park (robru) wrote :

There is no such log.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Can you remove the /home/robru/.machines/clean-precise-i386.qcow2 file, and try again, and then attach the log file generated in /var/log/libvirt/libvirtd.log and whatever is in /var/log/libvirt/qemu?

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Also, please use uvt with -v to get more debugging messages

Revision history for this message
Robert Bruce Park (robru) wrote :

libvirtd.log indicated that xen-common was missing. I installed it, deleted the log file, and reran with the same results:

$ uvt new -v precise i386 clean
Creating '/home/robru/.machines' directory...
Creating 'clean-precise-i386' VM with:
Memory: 1024
Image size: 8GB
Release: precise - 12.04
Release ISO file: ubuntu-12.04.3-desktop-i386.iso
Pristine snapshot: True
Confirm? [N]|y: y
Creating preseeded iso...
Preseeded iso file successfully created: vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso
Problem creating virtual machine 'clean-precise-i386' (doesn't exist). Aborting.

/var/log/libvirt/qemu is empty, and /var/log/libvirt/libvirtd.log was not recreated.

Revision history for this message
Robert Bruce Park (robru) wrote :

Ah, it looks like verbose is actually -V (capital v). Here I tried again:

$ uvt new -V precise i386 clean
Creating '/home/robru/.machines' directory...
Creating 'clean-precise-i386' VM with:
Memory: 1024
Image size: 8GB
Release: precise - 12.04
Release ISO file: ubuntu-12.04.3-desktop-i386.iso
Pristine snapshot: True
Confirm? [N]|y: y
Creating preseeded iso...
Preseeded iso file successfully created: vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso
Running:
qemu-img create -f qcow2 -o size=8G /home/robru/.machines/clean-precise-i386.qcow2
Running:
qemu-img check -f qcow2 /home/robru/.machines/clean-precise-i386.qcow2
Running:
virt-install --quiet --connect=qemu:///system --name=clean-precise-i386 --arch=i386 --ram=1024 --disk=path=/home/robru/.machines/clean-precise-i386.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=default,model=virtio --video=cirrus --noreboot
Problem creating virtual machine 'clean-precise-i386' (doesn't exist). Aborting.

If I try to run virt-install by hand I get this:

$ virt-install --quiet --connect=qemu:///system --name=clean-precise-i386 --arch=i386 --ram=1024 --disk=path=/home/robru/.machines/clean-precise-i386.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=default,model=virtio --video=cirrus --noreboot
ERROR Error in network device parameters: Virtual network 'default' has not been started.

That error seems more meaningful. How do I start default networking?

Still no logfiles created.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

What's the result of "virsh net-list"?

The default network is supposed to be created by default when you install libvirt.

Do you have anything in /etc/libvirt/qemu/networks/?

Revision history for this message
Robert Bruce Park (robru) wrote :

$ virsh net-list
 Name State Autostart Persistent
----------------------------------------------------------

$ ls -R /etc/libvirt/qemu/networks/
/etc/libvirt/qemu/networks/:
autostart default.xml

/etc/libvirt/qemu/networks/autostart:

$ cat /etc/libvirt/qemu/networks/default.xml
<network>
  <name>default</name>
  <bridge name="virbr0" />
  <forward/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254" />
    </dhcp>
  </ip>
</network>

Revision history for this message
Robert Bruce Park (robru) wrote :
Download full text (3.9 KiB)

Poked at this a little bit more, after some googling:

$ virsh net-list --all
 Name State Autostart Persistent
----------------------------------------------------------
 default inactive no yes

$ virsh net-start default
Network default started

$ uvt new precise i386 clean
Creating '/home/robru/.machines' directory...
Creating 'clean-precise-i386' VM with:
Memory: 1024
Image size: 8GB
Release: precise - 12.04
Release ISO file: ubuntu-12.04.3-desktop-i386.iso
Pristine snapshot: True
Confirm? [N]|y: y
Creating preseeded iso...
Preseeded iso file successfully created: vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso
Problem creating virtual machine 'clean-precise-i386' (doesn't exist). Aborting.

$ virsh net-list --all
 Name State Autostart Persistent
----------------------------------------------------------
 default active no yes

$ ifconfig
[snip]
virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
          inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
          UP BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
[snip]

$ virt-install --quiet --connect=qemu:///system --name=clean-precise-i386 --arch=i386 --ram=1024 --disk=path=/home/robru/.machines/clean-precise-i386.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=default,model=virtio --video=cirrus --noreboot
ERROR internal error: process exited while connecting to monitor: W: kvm binary is deprecated, please use qemu-system-x86_64 instead
char device redirected to /dev/pts/2 (label charserial0)
qemu-system-x86_64: -drive file=/home/robru/.machines/clean-precise-i386.qcow2,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /home/robru/.machines/clean-precise-i386.qcow2: Permission denied

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start clean-precise-i386
otherwise, please restart your installation.

$ virsh --connect qemu:///system start clean-precise-i386
error: failed to get domain 'clean-precise-i386'
error: Domain not found: no domain with matching name 'clean-precise-i386'

$ ls -l ~/.machines/
total 136
-rw-r--r-- 1 root root 131072 Oct 30 00:03 clean-precise-i386.qcow2

$ sudo chown robru:robru ~/.machines/clean-precise-i386.qcow2

$ virt-install --quiet --connect=qemu:///system --name=clean-precise-i386 --arch=i386 --ram=1024 --disk=path=/home/robru/.machines/clean-precise-i386.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=d...

Read more...

Revision history for this message
Robert Bruce Park (robru) wrote :

Copied somebody else's default.xml found online, still no luck:

$ cat /etc/libvirt/qemu/networks/default.xml
<network>
<name>default</name>
<uuid>40447e3e-4b09-44db-bc70-decef1189044</uuid>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0' />
<mac address='52:54:00:38:FF:C4'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
</dhcp>
</ip>
</network>

$ virsh net-start default
Network default started

$ uvt new -V precise i386 clean
Creating '/home/robru/.machines' directory...
Creating 'clean-precise-i386' VM with:
Memory: 1024
Image size: 8GB
Release: precise - 12.04
Release ISO file: ubuntu-12.04.3-desktop-i386.iso
Pristine snapshot: True
Confirm? [N]|y: y
Creating preseeded iso...
Preseeded iso file successfully created: vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso
Running:
qemu-img create -f qcow2 -o size=8G /home/robru/.machines/clean-precise-i386.qcow2
Running:
qemu-img check -f qcow2 /home/robru/.machines/clean-precise-i386.qcow2
Running:
virt-install --quiet --connect=qemu:///system --name=clean-precise-i386 --arch=i386 --ram=1024 --disk=path=/home/robru/.machines/clean-precise-i386.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=default,model=virtio --video=cirrus --noreboot
Problem creating virtual machine 'clean-precise-i386' (doesn't exist). Aborting.

$ virt-install --quiet --connect=qemu:///system --name=clean-precise-i386 --arch=i386 --ram=1024 --disk=path=/home/robru/.machines/clean-precise-i386.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-i386-ubuntu-12.04.3-desktop-i386.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=default,model=virtio --video=cirrus --noreboot
ERROR internal error: process exited while connecting to monitor: W: kvm binary is deprecated, please use qemu-system-x86_64 instead
char device redirected to /dev/pts/2 (label charserial0)
qemu-system-x86_64: -drive file=/home/robru/.machines/clean-precise-i386.qcow2,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /home/robru/.machines/clean-precise-i386.qcow2: Permission denied

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start clean-precise-i386
otherwise, please restart your installation.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Ok, there is definitely a permissions problem.

What are the permissions on /home/robru?
What are the permissions on /home/robru/.machines

Could you also try with machines not being a hidden directory? The libvirt security plugin may be preventing writing to hidden directories.

Do you get anything if you type "dmesg | grep DENIED"?

Revision history for this message
Robert Bruce Park (robru) wrote :

$ dmesg | grep DENIED

$ ls -ld ~
drwxr-x---+ 69 robru minidlna 36864 Oct 30 09:02 /home/robru

$ ls -ld ~/.machines/
drwxr-xr-x 2 robru robru 4096 Oct 30 09:25 /home/robru/.machines/

$ uvt new -V precise amd64 clean
Creating '/home/robru/VMs' directory...
The current libvirt 'uvt' pool is set to:
/home/robru/.machines

The uvt configuration wants it to be located here:
/home/robru/VMs

Changing the pool path may break existing VMs.

Would you like to change the pool path? [N]|y: y
Creating 'clean-precise-amd64' VM with:
Memory: 1024
Image size: 8GB
Release: precise - 12.04
Release ISO file: ubuntu-12.04.3-desktop-amd64.iso
Pristine snapshot: True
Confirm? [N]|y: y
Creating preseeded iso...
Preseeded iso file successfully created: vmtools-clean-precise-amd64-ubuntu-12.04.3-desktop-amd64.iso
Running:
qemu-img create -f qcow2 -o size=8G /home/robru/VMs/clean-precise-amd64.qcow2
Running:
qemu-img check -f qcow2 /home/robru/VMs/clean-precise-amd64.qcow2
Running:
virt-install --quiet --connect=qemu:///system --name=clean-precise-amd64 --arch=x86_64 --ram=1024 --disk=path=/home/robru/VMs/clean-precise-amd64.qcow2,size=8,format=qcow2,sparse=true,bus=virtio --virt-type=kvm --accelerate --hvm --cdrom=/home/robru/ISOs/cache/vmtools-clean-precise-amd64-ubuntu-12.04.3-desktop-amd64.iso --os-type=linux --os-variant=generic26 --graphics=vnc --network=network=default,model=virtio --video=cirrus --noreboot

[at this point a VM window actually appears for the first time, except instead of loading anything useful, it just infinitely spews the message "Could not find kernel image: /casper/vmlinuz"]

Also, it asks about switching from ~/.machines to ~/VMs *every* time I run it, regardless of the fact that ~/.machines has been deleted. How can I make that change permanent? Why does it not remember that I said yes each time?

Revision history for this message
Marc Deslauriers (mdeslaur) wrote : Re: [Bug 1246121] Re: Cannot create VMs.

On 13-10-30 09:43 AM, Robert Bruce Park wrote:
> $ ls -ld ~
> drwxr-x---+ 69 robru minidlna 36864 Oct 30 09:02 /home/robru

Hrm, these aren't default permissions. I believe libvirt spawns the kvm process
as the libvirt-qemu user, so having those permissions may be contributing to the
issues.

> [at this point a VM window actually appears for the first time, except
> instead of loading anything useful, it just infinitely spews the message
> "Could not find kernel image: /casper/vmlinuz"]

That is quite odd. Either the injected iso didn't get built properly, or there
are permission issues.

> Also, it asks about switching from ~/.machines to ~/VMs *every* time I
> run it, regardless of the fact that ~/.machines has been deleted. How
> can I make that change permanent? Why does it not remember that I said
> yes each time?
>

That's unusual. You're running Precise, right? I'll have to see why libvirt on
precise isn't keeping that setting.

Revision history for this message
Robert Bruce Park (robru) wrote :

*I'm* on Trusty, but the image I'm trying to run is Precise.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

This was likely fixed by this embarrassing commit:

http://bazaar.launchpad.net/~ubuntu-bugcontrol/ubuntu-qa-tools/master/revision/1030

Closing this bug. Please file a new one if it is still an issue.

Changed in ubuntu-qa-tools:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.