virt-manager cannot create image file

Bug #405388 reported by Tux on 2009-07-27
84
This bug affects 15 people
Affects Status Importance Assigned to Milestone
virt-manager (Ubuntu)
High
Tux

Bug Description

I am running Ubuntu Karmic Alpha 3 with X64 architecture on a Acer Aspire 5051AWXMi.
Kernel version:
Linux haasje 2.6.31-4-generic #22-Ubuntu SMP Fri Jul 24 18:05:56 UTC 2009 x86_64 GNU/Linux

lsb_release -rd
Description: Ubuntu karmic (development branch)
Release: 9.10

apt-cache policy kvm
kvm:
  Geïnstalleerd: 1:84+dfsg-0ubuntu15
  Kandidaat: 1:84+dfsg-0ubuntu15
  Versietabel:
 *** 1:84+dfsg-0ubuntu15 0
        500 http://nl.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

apt-cache policy virt-manager
virt-manager:
  Geïnstalleerd: 0.7.0-3ubuntu1
  Kandidaat: 0.7.0-3ubuntu1
  Versietabel:
 *** 0.7.0-3ubuntu1 0
        500 http://nl.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

apt-cache policy python
python:
  Geïnstalleerd: 2.6.2-0ubuntu1
  Kandidaat: 2.6.2-0ubuntu1
  Versietabel:
 *** 2.6.2-0ubuntu1 0
        500 http://nl.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

When I want to create a new virtual machine from the virt-manager I get the following error:
Unable to complete install '<type 'exceptions.RuntimeError'> Couldn't create storage volume 'Rawhide.img': 'cannot create path '/var/lib/libvirt/images/Rawhide.img': Permission denied'
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1485, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 541, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 628, in _do_install
    self._create_devices(meter)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 601, in _create_devices
    disk.setup(progresscb)
  File "/usr/lib/python2.6/dist-packages/virtinst/VirtualDisk.py", line 611, in setup
    self._set_vol_object(self.vol_install.install(meter=progresscb),
  File "/usr/lib/python2.6/dist-packages/virtinst/Storage.py", line 905, in install
    (self.name, str(e)))
RuntimeError: Couldn't create storage volume 'Rawhide.img': 'cannot create path '/var/lib/libvirt/images/Rawhide.img': Permission denied'
'

I have reinstalled kvm with dependencies, but that did not lead to a good result.

Tux (peter-hoogkamer) on 2009-08-04
affects: haze (Ubuntu) → virt-manager (Ubuntu)
Patrice Vetsel (vetsel-patrice) wrote :

I confirm that bug

Unable to complete install: 'Couldn't create storage volume 'testkarmic.img': 'cannot create path '/var/lib/libvirt/images/asas.img': Permission denied'

with Virtual Machine Manager 0.7.0 (0.7.0-3ubuntu1)

Unable to complete install '<type 'exceptions.RuntimeError'> Couldn't create storage volume 'testkarmic.img': 'cannot create path '/var/lib/libvirt/images/testkarmic.img': Permission denied'
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1485, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 541, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 628, in _do_install
    self._create_devices(meter)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 601, in _create_devices
    disk.setup(progresscb)
  File "/usr/lib/python2.6/dist-packages/virtinst/VirtualDisk.py", line 611, in setup
    self._set_vol_object(self.vol_install.install(meter=progresscb),
  File "/usr/lib/python2.6/dist-packages/virtinst/Storage.py", line 905, in install
    (self.name, str(e)))
RuntimeError: Couldn't create storage volume 'testkarmic.img': 'cannot create path '/var/lib/libvirt/images/testkarmic.img': Permission denied'
'

Changed in virt-manager (Ubuntu):
status: New → Confirmed
importance: Undecided → High

I don't think so, because my error message states a permission denied at the
error message when creating the image in /var/lib/libvirt/images/.

Unable to complete install '<type 'exceptions.RuntimeError'> Couldn't create
storage volume 'test.img': 'cannot create path
'/var/lib/libvirt/images/test.img': Permission denied'
Traceback (most recent call last):
 File "/usr/share/virt-manager/virtManager/create.py", line 1485, in
do_install
   dom = guest.start_install(False, meter = meter)
 File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 541, in
start_install
   return self._do_install(consolecb, meter, removeOld, wait)
 File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 628, in
_do_install
   self._create_devices(meter)
 File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 601, in
_create_devices
   disk.setup(progresscb)
 File "/usr/lib/python2.6/dist-packages/virtinst/VirtualDisk.py", line 611,
in setup
   self._set_vol_object(self.vol_install.install(meter=progresscb),
 File "/usr/lib/python2.6/dist-packages/virtinst/Storage.py", line 905, in
install
   (self.name, str(e)))
RuntimeError: Couldn't create storage volume 'test.img': 'cannot create path
'/var/lib/libvirt/images/test.img': Permission denied'
'

2009/8/12 Patrice Vetsel <email address hidden>:
> May be same bug as in Debian : http://bugs.debian.org/cgi-
> bin/bugreport.cgi?bug=512773
>
> --
> virt-manager cannot create image file
> https://bugs.launchpad.net/bugs/405388
> You received this bug notification because you are a direct subscriber
> of the bug.
>

SqUe (sque) wrote :

I can confirm the same exactly behaviour on Karmic Beta amd64

Unable to complete install '<type 'exceptions.RuntimeError'> Couldn't create storage volume 'test.img': 'cannot create path '/var/lib/libvirt/images/test.img': Permission denied'
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1485, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 541, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 628, in _do_install
    self._create_devices(meter)
  File "/usr/lib/python2.6/dist-packages/virtinst/Guest.py", line 601, in _create_devices
    disk.setup(progresscb)
  File "/usr/lib/python2.6/dist-packages/virtinst/VirtualDisk.py", line 611, in setup
    self._set_vol_object(self.vol_install.install(meter=progresscb),
  File "/usr/lib/python2.6/dist-packages/virtinst/Storage.py", line 905, in install
    (self.name, str(e)))
RuntimeError: Couldn't create storage volume 'test.img': 'cannot create path '/var/lib/libvirt/images/test.img': Permission denied'
'

 lsb_release -rd
Description: Ubuntu karmic (development branch)
Release: 9.10

 apt-cache policy qemu-kvm
qemu-kvm:
  Installed: 0.11.0~rc2-0ubuntu12
  Candidate: 0.11.0~rc2-0ubuntu12
  Version table:
 *** 0.11.0~rc2-0ubuntu12 0
        500 http://gr.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

apt-cache policy libvirt-bin
libvirt-bin:
  Installed: 0.7.0-1ubuntu8
  Candidate: 0.7.0-1ubuntu8
  Version table:
 *** 0.7.0-1ubuntu8 0
        500 http://gr.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

apt-cache policy virt-manager
virt-manager:
  Installed: 0.7.0-3ubuntu1
  Candidate: 0.7.0-3ubuntu1
  Version table:
 *** 0.7.0-3ubuntu1 0
        500 http://gr.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

The same error happens even from host details->storage and add new volume.
However I created a new storage pool inside my home folder and the virt-manager was able to create
new volumes with no problem. I think it is definetly a perminsions problem.

SqUe (sque) wrote :

After playing around with virtual manager. I finally understood what is the problem. I am writing it down for the next one with the same problem.

As defined here: http://libvirt.org/drvqemu.html
The libvirt QEMU driver is a multi-instance driver, providing a single system wide privileged driver (the "system" instance), and per-user unprivileged drivers (the "session" instance). The of the driver protocol is "qemu". Some example conection URIs for the libvirt driver are: qemu:///session, qemu:///system

What is happening is that virtual manager lists only qemu://session (the user instance of driver) This instance "session" does not have privileges to write to system pool, it has only the privileges of the user. If someone is trying to create a new virtual disk from the "qemu://session" in the system pool, it will not work.

If you are local admin of libvirt (by default all local admins are libvirtd admins too) you can add manage the system instance by navigating file->add connection and select hypervision QEMU/KVM and connection local. This will add one more connection that will be named localhost(System). This connection is priviliged you can even edit networks, create machines in the main pool and AFAIK vms that reside in system instance can be configured to auto-start too.

This bug seems invalid, but there is a bug that the interface is not helping new-comer. A bug could be considered that the first time you run virtual-manager, it runs with "session" connection but the only available pool is from "system"

Fabián Rodríguez (magicfab) wrote :

@SqUe thanks for the explanation, however I keep getting the same error after I try your workaround.

I now have 2 sessions, one localhost (System) indicating Active (RO) ("read only" ?) and the other indicating localhost (user) Active. I can only go further than the first dialog in the user session, and then I get the same permission errors.

Joseph Maillardet (jokx) wrote :

Hi, I have the same comportment and I found a solution :

1. Left click on the default connection named : localhost(user)
2. Choose "Details" and Go to "Storage"
3. Create a new file storage pool by clicking the green "+"
4. Give a name to your pool and hit "next"
5. Choose a file-system folder where your user have write permission and hit "finish"
6. Deactivate the "default" pool by choosing it and hitting the red cross

Now you can close the "host detail" windows and create a new virtual machine, the virtual disk will be created in your "local" pool where you have write permission.

Gabe Gorelick (gabegorelick) wrote :

This is really bad interface design. Why doesn't virt-manager do like every other linux app does and just use polkit to prompt for a password if the user isn't in the right group instead of just erroring out?

Marc Deslauriers (mdeslaur) wrote :

Is this still an issue?

Make sure you are using the "localhost (QEMU)" connection and that your user is in the libvirtd group.

Changed in virt-manager (Ubuntu):
assignee: nobody → Tux (peter-hoogkamer)
status: Confirmed → Fix Released
status: Fix Released → Incomplete
Soren Hansen (soren) wrote :

This should be fixed upstream:

   http://hg.fedorahosted.org/hg/virt-manager/rev/09484a201bda

(first upstream release to include the fix is 0.8.0, so fixed in Lucid)

Changed in virt-manager (Ubuntu):
status: Incomplete → Fix Released
David Ayers (ayers) wrote :

I'm trying to reproduce another bug and I believe I've run into this issue after installing beta2 (i386) and attempting to create a new image:

Unable to complete install '<class 'libvirt.libvirtError'> internal error unable to start guest: char device redirected to /dev/pts/2
qemu: could not open disk image /var/lib/libvirt/images/lucid.img: No such file or directory

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1436, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 660, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 758, in _do_install
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib/python2.6/dist-packages/libvirt.py", line 1097, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error unable to start guest: char device redirected to /dev/pts/2
qemu: could not open disk image /var/lib/libvirt/images/lucid.img: No such file or directory

'

I'm trying to create new image under:
localhost (QEMU Usermode)

kolya (mar-kolya) wrote :

Have same issue: cannot create new qemu VM, it fails with same error message:
qemu: could not open disk image /var/lib/libvirt/images/lucid.img: No such file or directory

I guess that it's because everything inside /var/lib/libvirt/ is owned my root.
Is this expected?
Thanks.

Francis Galiegue (fgaliegue) wrote :

I also have the issue on a base Lucid install, and there's a real issue there, which is not fixed in Lucid at least. There are two problems:

* the qemu://session thing, already discussed above;
* the permissions on /var/lib/libvirt/*.

When you try and create a machine, the user trying to create it is the one connected to qemu; it must be in the libvirtd group to run, so far so good. BUT:

* qemu://session makes it so that the configuration of the VM is stored in $HOME/.libvirt, not in /var/lib/libvirt;
* however, images are still created in /var/lib/libvirt/images!

The image creation fails, because all directories in /var/lib/libvirt are 755,root,root. I changed them to 770,root,libvirtd and the problem is fixed. But that's only a workaround.

I don't know, really, where VMs should be stored in a qemu://session thing, but I quite surmise that it shouldn't be in /var/lib/libvirt/images to start with.

ali saeedi (ali1203) wrote :

Hi
I have shared a storage between two host by nfs in virt-manager but when i trying to build a volume , i encounter this error :
"Error creating vol: internal error: Child process (/usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,compat=1.1,lazy_refcounts /home/ali/images/img3/img3.qcow2 8388608K) unexpected exit status 1: qemu-img: /home/ali/images/img3/img3.qcow2: Could not create file: Permission denied"
please help me to solve this error ... thanks alot

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers