Bug 579067

Summary: libvirt: qcow2/lvm backing image permissions are NOT changed to qemu:qemu
Product: [Fedora] Fedora Reporter: thanosk <thanosk>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: berrange, clalance, crobinso, hbrock, itamar, jforbes, mbooth, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.7.1-18.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-07-08 14:18:10 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description thanosk 2010-04-02 08:52:25 EDT
When I attempt to create a new VM I get the following error : 

Unable to complete install '<class 'libvirt.libvirtError'> internal error unable to start guest: qemu: could not open disk image /var/lib/libvirt/images/Test.img: Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1435, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 660, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 758, in _do_install
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib/python2.6/site-packages/libvirt.py", line 1077, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error unable to start guest: qemu: could not open disk image /var/lib/libvirt/images/Test.img: Permission denied

The image file Test.img was alredy created using a different image file as base 
using the following command
qemu-img create -b CentOS.img -f  qcow2  Test.img

File permissions and SELinux Context seems appropriate

# ls -Z Test.img 
-rw-------. root root system_u:object_r:virt_image_t:s0 Torrent.img


The image loads without any problems from the command line as root using
qemu Test.img
Comment 1 Cole Robinson 2010-04-05 12:34:04 EDT
Hmm, I think there are known permission issues with libvirt security drivers and files with backing stores.

Can you provide:

ls -Z /var/lib/libvirt/images
virsh pool-list /var/lib/libvirt/images
virsh vol-dumpxml /var/lib/libvirt/images/Test.img

Does 'setenforce 0' help?

Re-assiging to libvirt.
Comment 2 thanosk 2010-04-05 16:16:00 EDT
# ls -Z /var/lib/libvirt/images/

-rw-------. root    root    system_u:object_r:virt_content_t:s0 CentOS-Base-1.img
-rwxr--r--. root    root    system_u:object_r:virt_content_t:s0 CentOS-Base.img
-rw-r--r--. root    root    unconfined_u:object_r:virt_image_t:s0 CentOS-TWiki.img
-rwxr--r--. root    root    unconfined_u:object_r:virt_image_t:s0 CentOS-Zimbra.img
-rw-------. root    root    system_u:object_r:virt_image_t:s0 Drupal.img
-rw-------. root    root    system_u:object_r:virt_image_t:s0 ProcessMaker.img
-rw-------. root    root    system_u:object_r:virt_image_t:s0 Qmail.img
-rw-------. root    root    system_u:object_r:virt_image_t:s0 Test.img
-rw-------. root    root    system_u:object_r:virt_image_t:s0 WindowsXP.img

# virsh pool-list /var/lib/libvirt/images/
error: unexpected data '/var/lib/libvirt/images/'

# virsh vol-dumpxml /var/lib/libvirt/images/Test.img
<volume>
  <name>Test.img</name>
  <key>/var/lib/libvirt/images/Test.img</key>
  <source>
  </source>
  <capacity>25769803776</capacity>
  <allocation>30613504</allocation>
  <target>
    <path>/var/lib/libvirt/images/Test.img</path>
    <format type='qcow'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
  </target>
  <backingStore>
    <path>/var/lib/libvirt/images/CentOS-Base-1.img</path>
    <format type='raw'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_content_t:s0</label>
    </permissions>
  </backingStore>
</volume>


SELinux is in permissive mode on purpose because I was getting too much grief 
from various applications
Comment 3 Bug Zapper 2010-04-28 08:00:50 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 4 thanosk 2010-04-28 12:21:16 EDT
I marked the bug as concerning ver 11 of Fedora by mistake. 
I am using F12

(In reply to comment #3)
> This message is a reminder that Fedora 11 is nearing its end of life.
> Approximately 30 (thirty) days from now Fedora will stop maintaining
> and issuing updates for Fedora 11.  It is Fedora's policy to close all
> bug reports from releases that are no longer maintained.  At that time
> this bug will be closed as WONTFIX if it remains open with a Fedora 
> 'version' of '11'.
> 
> Package Maintainer: If you wish for this bug to remain open because you
> plan to fix it in a currently maintained version, simply change the 'version' 
> to a later Fedora version prior to Fedora 11's end of life.
> 
> Bug Reporter: Thank you for reporting this issue and we are sorry that 
> we may not be able to fix it before Fedora 11 is end of life.  If you 
> would still like to see this bug fixed and are able to reproduce it 
> against a later version of Fedora please change the 'version' of this 
> bug to the applicable version.  If you are unable to change the version, 
> please add a comment here and someone will do it for you.
> 
> Although we aim to fix as many bugs as possible during every release's 
> lifetime, sometimes those efforts are overtaken by events.  Often a 
> more recent Fedora release includes newer upstream software that fixes 
> bugs or makes them obsolete.
> 
> The process we are following is described here: 
> http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 5 Cole Robinson 2010-05-26 14:06:07 EDT
*** Bug 548401 has been marked as a duplicate of this bug. ***
Comment 6 Cole Robinson 2010-06-03 14:01:51 EDT
This is fixed upstream, moving to POST.
Comment 7 Fedora Update System 2010-06-17 12:55:38 EDT
libvirt-0.7.1-18.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/libvirt-0.7.1-18.fc12
Comment 8 Fedora Update System 2010-06-21 09:02:19 EDT
libvirt-0.7.1-18.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libvirt'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/libvirt-0.7.1-18.fc12
Comment 9 Fedora Update System 2010-07-08 14:17:07 EDT
libvirt-0.7.1-18.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.