Bug 693966

Summary: Installation fails when install guest under usermode connection
Product: Red Hat Enterprise Linux 6 Reporter: Min Zhan <mzhan>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 6.1CC: crobinso, dyuan, eblake, llim, mshao, mzhan, yoyzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-12 15:12:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Min Zhan 2011-04-06 05:45:26 UTC
Description of problem:
Launch # virt-manager -c qemu:///session, connect and new a guest in this connection, found the installation fails

Version-Release number of selected component (if applicable):
virt-manager-0.8.6-3.el6.noarch
$ uname -a
Linux localhost.localdomain 2.6.32-128.el6.x86_64 #1 SMP Mon Mar 28 21:55:33 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
qemu-kvm-0.12.1.2-2.153.el6.x86_64
libvirt-0.8.7-15.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. launch virt-manager in usermode
[min@localhost root]$ virt-manager -c qemu:///session

2. In this connection, click New button to create a new guest, forward and finish the configure.Then Begin creating the vm, an error display which make installation can not continue 
  
Actual results:

An error display as following:
Unable to complete install: 'internal error Process exited while reading console log output: '
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 45, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 1622, in do_install
    guest.start_install(False, meter=meter)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1193, in start_install
    start_xml, final_xml, is_initial)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1252, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1341, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: 


Expected results:
Installation should be success

Additional info:
[min@localhost root]$ tail -f /home/min/.virt-manager/virt-manager.log 
...
[Wed, 06 Apr 2011 13:54:23 virt-manager 10469] DEBUG (Guest:1229) Generated boot XML: 
<domain type='kvm'>
  <name>new</name>
  <currentMemory>524288</currentMemory>
  <memory>524288</memory>
  <uuid>d681e849-2ef4-7cc3-6945-deed298521cb</uuid>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/><apic/><pae/>
  </features>
  <clock offset="utc"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <vcpu>1</vcpu>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source file='/home/min/VirtualMachines/new.img'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <interface type='user'>
      <mac address='52:54:00:57:fc:d2'/>
      <model type='virtio'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <graphics type='vnc' port='-1'/>
    <console type='pty'/>
    <sound model='ich6'/>
    <video>
      <model type='cirrus'/>
    </video>
  </devices>
</domain>

[Wed, 06 Apr 2011 13:54:23 virt-manager 10469] DEBUG (Installer:359) Removing /home/min/.virtinst/boot/virtinst-vmlinuz.OTy03G
[Wed, 06 Apr 2011 13:54:23 virt-manager 10469] DEBUG (Installer:359) Removing /home/min/.virtinst/boot/virtinst-initrd.img.IuyVwP
[Wed, 06 Apr 2011 13:54:23 virt-manager 10469] DEBUG (error:66) dialog message: Unable to complete install: 'internal error Process exited while reading console log output: ' : Unable to complete install: 'internal error Process exited while reading console log output: '
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 45, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 1622, in do_install
    guest.start_install(False, meter=meter)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1193, in start_install
    start_xml, final_xml, is_initial)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1252, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1341, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output:

Comment 1 RHEL Program Management 2011-04-06 06:03:13 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 2 zhanghaiyan 2011-04-06 09:25:00 UTC
Also failed to create a new guest in non-root with virt-install
[test@localhost ~]$ virt-install -n rhel61 -r 2048 --vcpu=2  --location http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/ --disk path=/home/test/rhel61.img,size=6 --debug
Wed, 06 Apr 2011 05:16:27 DEBUG    Launched with command line:
/usr/bin/virt-install -n rhel61 -r 2048 --vcpu=2 --location http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/ --disk path=/home/test/rhel61.img,size=6 --debug
Wed, 06 Apr 2011 05:16:27 DEBUG    Requesting libvirt URI default
Wed, 06 Apr 2011 05:16:27 DEBUG    Received libvirt URI qemu:///session
Wed, 06 Apr 2011 05:16:28 DEBUG    Requesting virt method 'default', hv type 'default'.
Wed, 06 Apr 2011 05:16:28 DEBUG    Received virt method 'hvm'
Wed, 06 Apr 2011 05:16:28 DEBUG    Hypervisor name is 'kvm'
Wed, 06 Apr 2011 05:16:28 DEBUG    DISPLAY is set: graphics defaulting to VNC.
Wed, 06 Apr 2011 05:16:28 DEBUG    parse_disk: returning {'driverIO': None, 'format': None, 'bus': None, 'readOnly': False, 'volInstall': None, 'path': '/home/test/rhel61.img', 'device': 'disk', 'volName': None, 'conn': <libvirt.virConnect instance at 0x142de18>, 'size': 6.0, 'driverType': None, 'driverCache': None, 'shareable': False, 'driverName': None, 'sparse': True}
Wed, 06 Apr 2011 05:16:28 DEBUG    DistroInstaller location is a network source.
Wed, 06 Apr 2011 05:16:28 DEBUG    Attempting to detect distro:
Wed, 06 Apr 2011 05:16:28 DEBUG    Fetching URI: http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/.treeinfo
Wed, 06 Apr 2011 05:16:28 DEBUG    Saved file to /var/tmp/virtinst-.treeinfo.fMaBiM
Wed, 06 Apr 2011 05:16:28 DEBUG    Guest.has_install_phase: True

Starting install...
Wed, 06 Apr 2011 05:16:28 DEBUG    Attempting to detect distro:
Wed, 06 Apr 2011 05:16:28 DEBUG    Fetching URI: http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/.treeinfo
Wed, 06 Apr 2011 05:16:28 DEBUG    Saved file to /home/test/.virtinst/boot/virtinst-.treeinfo.HZphrx
Retrieving file .treeinfo...                                                                                                          | 3.3 kB     00:00 ... 
Wed, 06 Apr 2011 05:16:28 DEBUG    Fetching URI: http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/images/pxeboot/vmlinuz
Wed, 06 Apr 2011 05:16:28 DEBUG    Saved file to /home/test/.virtinst/boot/virtinst-vmlinuz.eGYuxn
Retrieving file vmlinuz...                                                                                                            | 7.4 MB     00:00 ... 
Wed, 06 Apr 2011 05:16:28 DEBUG    Fetching URI: http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/images/pxeboot/initrd.img
Wed, 06 Apr 2011 05:16:30 DEBUG    Saved file to /home/test/.virtinst/boot/virtinst-initrd.img.hjNH_K=======-              ]  19 MB/s |  25 MB     00:00 ETA 
Retrieving file initrd.img...                                                                                                         |  67 MB     00:01 ... 
Wed, 06 Apr 2011 05:16:30 DEBUG    Auto detected OS type as: linux
Wed, 06 Apr 2011 05:16:30 DEBUG    Auto detected OS variant as: rhel6
Wed, 06 Apr 2011 05:16:30 DEBUG    Generated install XML: 
<domain type='kvm'>
  <name>rhel61</name>
  <currentMemory>2097152</currentMemory>
  <memory>2097152</memory>
  <uuid>f9c8ac72-42e6-e620-eda1-575ce835eb28</uuid>
  <os>
    <type arch='x86_64'>hvm</type>
    <kernel>/home/test/.virtinst/boot/virtinst-vmlinuz.eGYuxn</kernel>
    <initrd>/home/test/.virtinst/boot/virtinst-initrd.img.hjNH_K</initrd>
    <cmdline>method=http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.1-20110330.2/6.1/Server/x86_64/os/</cmdline>
  </os>
  <features>
    <acpi/><apic/><pae/>
  </features>
  <clock offset="utc"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <vcpu>2</vcpu>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' cache='none' io='threads'/>
      <source file='/home/test/rhel61.img'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <interface type='user'>
      <mac address='52:54:00:0b:08:b0'/>
      <model type='virtio'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <graphics type='vnc' port='-1'/>
    <console type='pty'/>
    <video>
      <model type='cirrus'/>
    </video>
  </devices>
</domain>


Also failed to create a new guest in non-root using the above xml with virsh. So I will change the component to libvirt. 
[test@localhost ~]$ virsh define rhel61.xml 
Domain rhel61 defined from rhel61.xml

[test@localhost ~]$ virsh start rhel61
error: Failed to start domain rhel61
error: unable to set security context 'system_u:object_r:virt_content_t:s0' on '/home/test/.virtinst/boot/virtinst-vmlinuz.eGYuxn': No such file or directory

[test@localhost ~]$ ls /home/test/.virtinst/boot/
initrd.img  vmlinuz

Comment 3 Cole Robinson 2011-04-06 19:14:50 UTC
Please provide the output of ~/.libvirt/qemu/log/$vmname.log

Comment 4 Min Zhan 2011-04-07 06:47:31 UTC
# tail -f /home/min/.libvirt/qemu/log/new.log
...
2011-04-07 10:54:09.582: starting up
LC_ALL=C PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/min/bin HOME=/home/min USER=min LOGNAME=min QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.1.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name new -uuid 7270e4a2-f21b-b942-8d58-c9b14994d6c5 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/home/min/.libvirt/qemu/lib/new.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -boot c -kernel /home/min/.virtinst/boot/virtinst-vmlinuz.RHtNOF -initrd /home/min/.virtinst/boot/virtinst-initrd.img.hOwfwu -append method=http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.0/Server/x86_64/os/ -drive file=/home/min/VirtualMachines/new.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -netdev user,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ba:41:09,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:1 -vga cirrus -device AC97,id=sound0,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
2011-04-07 10:54:09.686: shutting down

Comment 5 Cole Robinson 2011-04-12 15:12:01 UTC
Does setenforce 0 help?

I can reproduce with a simpler command line:

virt-install -n rhel61 -r 128 --pxe --nodisks --noautoconsole --debug

Disabling selinux helps things move along. Messages in audit.log:

type=AVC msg=audit(1302620845.163:73709): avc:  denied  { write } for  pid=14065 comm="qemu-kvm" path="/home/localcole/.libvirt/qemu/log/rhel61.log" dev=dm-2 ino=132050 scontext=system_u:system_r:svirt_t:s0:c10,c260 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file
type=AVC msg=audit(1302620845.163:73709): avc:  denied  { write } for  pid=14065 comm="qemu-kvm" path="/home/localcole/.libvirt/qemu/log/rhel61.log" dev=dm-2 ino=132050 scontext=system_u:system_r:svirt_t:s0:c10,c260 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file
type=SYSCALL msg=audit(1302620845.163:73709): arch=c000003e syscall=59 success=yes exit=0 a0=7f785809fd20 a1=7f785809df70 a2=7f785809d1a0 a3=7f78710b7b10 items=0 ppid=1 pid=14065 auid=700 uid=700 gid=700 euid=700 suid=700 fsuid=700 egid=700 sgid=700 fsgid=700 tty=(none) ses=4 comm="qemu-kvm" exe="/usr/libexec/qemu-kvm" subj=system_u:system_r:svirt_t:s0:c10,c260 key=(null)
type=AVC msg=audit(1302620845.174:73710): avc:  denied  { write } for  pid=14065 comm="qemu-kvm" name="lib" dev=dm-2 ino=132040 scontext=system_u:system_r:svirt_t:s0:c10,c260 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=dir
type=SYSCALL msg=audit(1302620845.174:73710): arch=c000003e syscall=49 success=no exit=-13 a0=3 a1=7fffc7a20170 a2=6e a3=696c2f756d65712f items=0 ppid=1 pid=14065 auid=700 uid=700 gid=700 euid=700 suid=700 fsuid=700 egid=700 sgid=700 fsgid=700 tty=(none) ses=4 comm="qemu-kvm" exe="/usr/libexec/qemu-kvm" subj=system_u:system_r:svirt_t:s0:c10,c260 key=(null)

I think is just a dup of 676372

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

Comment 6 zhanghaiyan 2011-04-13 03:39:12 UTC
In non-root user, I succeed to create a guest via virt-install with selinux-policy-3.7.19-80.el6

Comment 7 zhanghaiyan 2011-04-13 10:01:32 UTC
In non-root user, I also succeed to create a guest via virt-manager with
selinux-policy-3.7.19-80.el6