Bug 580482 - virt-install: Warn if disk permissions may cause qemu to fail
Summary: virt-install: Warn if disk permissions may cause qemu to fail
Status: CLOSED DUPLICATE of bug 598175
Alias: None
Product: Fedora
Classification: Fedora
Component: python-virtinst   
(Show other bugs)
Version: rawhide
Hardware: x86_64
OS: Linux
low
high
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-08 11:31 UTC by Petr Beňas
Modified: 2015-01-04 22:59 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-01-25 18:44:41 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Petr Beňas 2010-04-08 11:31:37 UTC
Description of problem:
When trying to install guest from Fedora virtualization test day LiveCD http://jforbes.fedorapeople.org/virt-test-day/testday-20100408-x86_64.iso to mounted local drive the installation fails with Permission denied. 

The disc and install image have 777 permissions:
[liveuser@localhost fed]$ ll
total 8610028
-rwxrwxrwx. 1 root     root              0 Apr  8 11:44 disc.img
-rwxrwxrwx. 1 qemu     qemu     3573778432 Apr  8 11:35 RHEL5.4-Server-20090819.0-x86_64-DVD.iso
Directory permissions:
drwxrwxr-x.  2 liveuser liveuser        4096 Apr  8 12:01 fed

It's not SELinux issue, the behaviour is the same with SELinux disabled. (echo 0 > /selinux/enforce)

Version-Release number of selected component (if applicable):
    * kernel-2.6.33.1-19.fc13
    * libvirt-0.7.7-1.fc13
    * python-virtinst-0.500.2-3.fc13
    * qemu-0.12.3-6.fc13
    * seabios-0.5.1-1.fc13
    * virt-manager-0.8.3-2.fc13 

How reproducible:
always

Steps to Reproduce:
1. su -c "yum install @virtualization"
2. su -c "service libvirtd start"
3. su -c "/usr/sbin/virt-install --prompt"
  
Actual results:
[liveuser@localhost ~]$ su -c "/usr/sbin/virt-install --prompt"
What is the name of your virtual machine? rhel
 How much RAM should be allocated (in megabytes)? 1024
 What would you like to use as the disk (file path)? /media/b802208e-36b7-411b-a8b0-083e7e6eb6cd/pbenas/fed/disc.img
 What is the install CD-ROM/ISO or URL? /media/b802208e-36b7-411b-a8b0-083e7e6eb6cd/pbenas/fed/RHEL5.4-Server-20090819.0-x86_64-DVD.iso
 

Starting install...
ERROR    internal error Process exited while reading console log output: char device redirected to /dev/pts/4
qemu: could not open disk image /media/b802208e-36b7-411b-a8b0-083e7e6eb6cd/pbenas/fed/disc.img: Permission denied

Domain installation may not have been
 successful.  If it was, you can restart your domain
 by running 'virsh start rhel'; otherwise, please
 restart your installation.
ERROR    internal error Process exited while reading console log output: char device redirected to /dev/pts/4
qemu: could not open disk image /media/b802208e-36b7-411b-a8b0-083e7e6eb6cd/pbenas/fed/disc.img: Permission denied
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 972, in <module>
    main()
  File "/usr/sbin/virt-install", line 834, in main
    start_time, guest.start_install)
  File "/usr/sbin/virt-install", line 896, in do_install
    dom = install_func(conscb, progresscb, wait=(not wait))
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 798, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 899, in _do_install
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1147, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/4
qemu: could not open disk image /media/b802208e-36b7-411b-a8b0-083e7e6eb6cd/pbenas/fed/disc.img: Permission denied

Expected results:
successfull installation

Additional info:

Comment 1 Cole Robinson 2010-04-13 17:04:50 UTC
In order to use existing storage with default F13 settings, a couples things need to be in order:

- Storage needs proper selinux label (virt_image_t is sufficient). You can avoid this step by temporarily disabling selinux with 'setenforce 0'
- The directories need to be globally searchable, so that libvirt can change the file ownership to 'qemu' before launching the emulator.

We take care of warning about these issues and trying to correct them in virt-manager, we should do something similar for virt-install.

Comment 2 Michael Monreal 2010-06-07 15:07:42 UTC
I think I am running into a similar problem, using virt-manager. Could you point me to the "correct" set of changes needed in order to enable virt-manager/qemu to read the iso from my home directory?

Error output:

Unable to complete install '<class 'libvirt.libvirtError'> internal error Process exited while reading console log output: char device redirected to /dev/pts/2
qemu: could not open disk image /home/monreal/CentOS-5.4-i386-Live.iso: Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1553, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 981, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1046, in _do_install
    "install")
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1017, in _create_guest
    dom = self.conn.createLinux(start_xml, 0)
  File "/usr/lib/python2.6/site-packages/libvirt.py", line 1147, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/2
qemu: could not open disk image /home/monreal/CentOS-5.4-i386-Live.iso: Permission denied

'

Comment 3 champkuo 2011-01-22 22:35:19 UTC
Bug#574241 & Bug 580482 Solved!!! 

# virsh start TFS02
Bug#574241 Error Message:
Can't open domain TFS02
internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /root/201012/TFS02.qcow2: Permission denied
Bug 580482 - virt-install: Warn if disk permissions may cause qemu to fail

Solved Process:You need to activate the permission by change the configure file at /etc/libvirt/qemu.conf. for example:
# nano /etc/libvirt/qemu.conf
.........
# The user ID for QEMU processes run by the system instance
# user = "root"
# The group ID for QEMU processes run by the system instance
# group = "root"
Delete the mark "#" in front of  user and group then save it and reboot the node(Host Machine) 

please see the reporter's website:
http://www.plugboot.com/index.php?option=com_content&task=view&id=239&Itemid=66

Comment 4 Cole Robinson 2011-03-29 21:05:53 UTC
Since this isn't upstream yet, it's unlikely to be fixed in f13. Reassigning to rawhide.

Comment 5 Jan Willies 2011-04-11 08:00:40 UTC
I am still unable to install an image to a mounted disk. The modification of /etc/libvirt/qemu.conf didn't help me, neither am I running selinux. Also, 'chmod /media/400G' doesn't work (permissions don't change). F14 here

Comment 6 Cole Robinson 2012-01-25 18:44:41 UTC

*** This bug has been marked as a duplicate of bug 598175 ***


Note You need to log in before you can comment on or make changes to this bug.