Bug 624721 - [qemu] [rhel6] bad error handling when qemu has no 'read' permissions over {kernel,initrd} files [pass boot options]
[qemu] [rhel6] bad error handling when qemu has no 'read' permissions over {k...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.1
All Linux
low Severity high
: beta
: ---
Assigned To: Amit Shah
Virtualization Bugs
: Reopened, RHELNAK
: 624940 (view as bug list)
Depends On:
Blocks: 580953 580954 614852
  Show dependency treegraph
 
Reported: 2010-08-17 11:14 EDT by Haim
Modified: 2014-01-12 19:46 EST (History)
14 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.122.el6
Doc Type: Bug Fix
Doc Text:
QEMU silently failed when an invalid initrd file was passed, or the file did not exist. Due to this, VMs would not start and not show up any error as to why they wouldn't start. The fix is to check for the file's validity, and if invalid, throw an error, indicating to the user why the VM start fails.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-19 07:31:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
domain xml with <kernel> and <initrd> (2.58 KB, text/plain)
2010-08-17 14:19 EDT, Dan Kenigsberg
no flags Details

  None (edit)
Description Haim 2010-08-17 11:14:13 EDT
Description of problem:

we I pass Linux boot options to libvirt and create new domain, connection is refused and process exists. 
placed both initrd and kernel under tmp;
please see below for the qemu-command I used: 



17:59:49.811: debug : virExecWithHook:705 : LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.0.0 -cpu qemu64,-
svm -enable-kvm -m 256 -smp 1,sockets=1,cores=1,threads=1 -name ayal -uuid 9ffe28b6-6134-4b1e-8804-1185f49c436f -nodefconfig -nodefaults -chardev socket,id=mon
itor,path=/var/lib/libvirt/qemu/ayal.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=2010-7-17T14:59:49 -no-acpi -boot d -kernel /tmp/vmlinuz
-2.6.18-164.el5 -initrd /tmp/initrd-2.6.18-164.el5.img -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x4 -drive file=/net/qanashead.q
a.lab/export/iso/linux/Fedora-12-x86_64-DVD.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide
0-1-0,id=ide0-1-0 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=aa:bb:dd:dd:aa:bb,bus=pci.0,addr=0x3 -ch
ardev socket,id=channel0,path=/var/lib/libvirt/qemu/channels/ayal.org.linux-kvm.port.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=0,chardev=c
hannel0,name=org.linux-kvm.port.0 -usb -vnc 0:1 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
17:59:49.818: info : qemudDispatchSignalEvent:397 : Received unexpected signal 17
17:59:49.819: debug : qemudStartVMDaemon:4149 : Waiting for monitor to show up
17:59:49.819: debug : qemudWaitForMonitor:2512 : Connect monitor to 0x7f73c8004030 'ayal'
17:59:50.466: debug : virDomainBlockStats:4260 : domain=0x7f73c408c5f0, path=hda, stats=0x7f73d2cc4a90, size=40
17:59:52.826: error : qemuMonitorOpenUnix:279 : monitor socket did not show up.: Connection refused
17:59:52.826: debug : qemuMonitorClose:690 : mon=0x7f73c8061230
17:59:52.827: debug : qemuMonitorFree:200 : mon=0x7f73c8061230
17:59:52.827: info : qemuConnectMonitor:1617 : Failed to connect monitor for ayal
17:59:52.828: error : qemudWaitForMonitor:2548 : internal error process exited while connecting to monitor: 
17:59:52.828: debug : qemudShutdownVMDaemon:4254 : Shutting down VM 'ayal' migrated=0
17:59:52.828: warning : SELinuxRestoreSecurityFileLabel:385 : cannot lookup default selinux label for /tmp/vmlinuz-2.6.18-164.el5
17:59:52.828: warning : SELinuxRestoreSecurityFileLabel:385 : cannot lookup default selinux label for /tmp/initrd-2.6.18-164.el5.img
17:59:52.828: debug : virCgroupNew:493 : New group /libvirt/qemu/ayal

we also seem to have SElinux warning - though SElinux state is permissive - different bug ? 


17:59:52.828: warning : SELinuxRestoreSecurityFileLabel:385 : cannot lookup default selinux label for /tmp/vmlinuz-2.6.18-164.el5
17:59:52.828: warning : SELinuxRestoreSecurityFileLabel:385 : cannot lookup default selinux label for /tmp/initrd-2.6.18-164.el5.img

domain in xml format: 

<domain type='kvm' id='4'>
  <name>ayal</name>
  <uuid>9ffe28b6-6134-4b1e-8804-1185f49c436f</uuid>
  <memory>262144</memory>
  <currentMemory>262144</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.0.0'>hvm</type>
    <boot dev='cdrom'/>
    <!--initrd>/tmp/initrd-2.6.18-164.el5.img</initrd>
    <kernel>/tmp/vmlinuz-2.6.18-164.el5</kernel-->

  </os>
  <cpu match='exact'>
    <model>qemu64</model>
    <feature policy='disable' name='svm'/>
  </cpu>
  <clock offset='variable' adjustment='0'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/net/qanashead.qa.lab/export/iso/linux/Fedora-12-x86_64-DVD.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <controller type='virtio-serial' index='0' ports='16'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='aa:bb:dd:dd:aa:bb'/>
      <source bridge='rhevm'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channels/ayal.org.linux-kvm.port.0'/>
      <target type='virtio' name='org.linux-kvm.port.0'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='0'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' listen='0'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux'>
    <label>system_u:system_r:svirt_t:s0:c316,c474</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c316,c474</imagelabel>
  </seclabel>
</domain>

2.6.32-59.1.el6.x86_64
libvirt-0.8.1-23.el6.x86_64
vdsm-4.9-12.3.x86_64
device-mapper-multipath-0.4.9-25.el6.x86_64
lvm2-2.02.72-4.el6.x86_64
qemu-kvm-0.12.1.2-2.109.el6.x86_64
Comment 1 Daniel Berrange 2010-08-17 11:20:58 EDT
Please provide the /var/log/libvirt/qemu/$GUEST.log
Comment 3 RHEL Product and Program Management 2010-08-17 11:38:20 EDT
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **
Comment 4 Haim 2010-08-17 12:01:13 EDT
[root@silver-vdse tmp]# virsh create /tmp/ayal-boot.xml 
error: Failed to create domain from /tmp/ayal-boot.xml
error: internal error process exited while connecting to monitor: 


LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.0.0 -cpu qemu64,-svm -enable-kvm -m 256 -smp 1,sockets=1,cores=1,threads=1 -name ayal -uuid 9ffe28b6-6134-4b1e-8804-1185f49c436f -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/ayal.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=2010-7-17T15:0:11 -no-acpi -boot d -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x4 -drive file=/net/qanashead.qa.lab/export/iso/linux/Fedora-12-x86_64-DVD.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=aa:bb:dd:dd:aa:bb,bus=pci.0,addr=0x3 -chardev socket,id=channel0,path=/var/lib/libvirt/qemu/channels/ayal.org.linux-kvm.port.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=0,chardev=channel0,name=org.linux-kvm.port.0 -usb -vnc 0:1 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.0.0 -cpu qemu64,-svm -enable-kvm -m 256 -smp 1,sockets=1,cores=1,threads=1 -name ayal -uuid 9ffe28b6-6134-4b1e-8804-1185f49c436f -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/ayal.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=2010-7-17T16:3:18 -no-acpi -boot d -kernel /tmp/vmlinuz-2.6.18-164.el5 -initrd /tmp/initrd-2.6.18-164.el5.img -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x4 -drive file=/net/qanashead.qa.lab/export/iso/linux/Fedora-12-x86_64-DVD.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=23,id=hostnet0,vhost=on,vhostfd=24 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=aa:bb:dd:dd:aa:bb,bus=pci.0,addr=0x3 -chardev socket,id=channel0,path=/var/lib/libvirt/qemu/channels/ayal.org.linux-kvm.port.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=0,chardev=channel0,name=org.linux-kvm.port.0 -usb -vnc 0:1 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
Comment 5 Daniel Berrange 2010-08-17 12:12:47 EDT
Can you retry with the kernel+initrd in /var/lib/libvirt/boot instead of /tmp. Also your XML in the initial report has a bunch of stuff commented out with <!-- ... --> - can you provide the real XML
Comment 6 Dan Kenigsberg 2010-08-17 14:19:17 EDT
Created attachment 439184 [details]
domain xml with <kernel> and <initrd>

Same failure occurs when kernel/initrd sits under /var/lib/libvirt/boot. I commented out the kernel/initrd elements only to make sure they are the cause of the failure. Note that <kernel> without <initrd> starts up fine.

I attach the xml file named after our colleague abaron, out of respect for him, and of joy when issuing `destroy ayal`.
Comment 7 Daniel Berrange 2010-08-17 14:28:08 EDT
Are the kernel+initrd files readable (or owned) by the 'qemu' user ID ? Normally libvirt will change ownership to ensure this, but with VDSM running with dynamic_ownership=0, this won't happen.

What SELinux  AVC message do you get, if any ?
Comment 8 Dan Kenigsberg 2010-08-17 14:44:35 EDT
(In reply to comment #7)
> Are the kernel+initrd files readable (or owned) by the 'qemu' user ID ?
> Normally libvirt will change ownership to ensure this, but with VDSM running

Doh! I could have sworn that I had checked that myself.

It's great to have you around, Dan. Good night and sorry for the noise.
Comment 9 Daniel Berrange 2010-08-17 15:21:00 EDT
I'd recommend you file a bug against QEMU, because it completely failed to report any error due to the unreadable kernel/initrd files. It just silently failed. It loads initrd using

 load_image(initrd_filename, initrd_data);

note how it doesn't check the return code to see if it succeeded or not.....
Comment 10 Haim 2010-08-18 02:27:02 EDT
change bug: 

1) move to assigned 
2) change component from 'libvirt' to 'qemu' 
3) change headline. 

Dor - please see Daniel's comment.
Comment 12 Luiz Capitulino 2010-12-01 06:42:50 EST
*** Bug 624940 has been marked as a duplicate of this bug. ***
Comment 16 Haim 2010-12-24 11:41:03 EST
verified on libvirt-0.8.6-1.el6.x86_64, qemu-kvm-0.12.1.2-2.113.el6.x86_64

tried to start domain with files where qemu has no permission on: 

[root@magenta-vdsd tmp]# virsh create /tmp/ayal.xml

error: Failed to create domain from /tmp/ayal.xml
error: internal error process exited while connecting to monitor: qemu: could not load kernel '/tmp/vmlinuz-2.6.18-164.el5': Inappropriate ioctl for device
Comment 17 Amit Shah 2011-05-04 06:55:49 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
QEMU silently failed when an invalid initrd file was passed, or the file did not exist.  Due to this, VMs would not start and not show up any error as to why they wouldn't start.  The fix is to check for the file's validity, and if invalid, throw an error, indicating to the user why the VM start fails.
Comment 19 errata-xmlrpc 2011-05-19 07:31:22 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html
Comment 20 errata-xmlrpc 2011-05-19 08:47:14 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

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