Bug 249594

Summary: libvirtd crash when creating a kvm guest
Product: [Fedora] Fedora Reporter: Sven Oehme <oehmes>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 7CC: berrange, mishu
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.3.1-2.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-06 14:09:18 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
strace of libvirtd while its dying
none
virt-install debug output
none
output of virt-install
none
strace of libvirtd while its dying
none
Fix check for bogus architecture none

Description Sven Oehme 2007-07-25 13:10:47 EDT
Description of problem:

when you try to install a full virtualized guest using virt-install, libvirtd
crashes ..

Version-Release number of selected component (if applicable):

rpm -qa |egrep 'virt|qemu|kvm|xen'
libvirt-python-0.3.0-1.fc7
xen-3.1.0-2.fc7
xen-libs-3.1.0-2.fc7
python-virtinst-0.200.0-1.fc7
libvirt-0.3.0-1.fc7
kernel-xen-2.6.20-2925.13.fc7
virt-manager-0.4.0-2.fc7
qemu-0.9.0-2.fc7
kvm-24-1


How reproducible:

just install a full virtualized Guest using virt-install 

Steps to Reproduce:
1. start fedaora 7
2. put a RHEL5 cd in your cdrom drive 
3. run virt-install -n RHEL5_1 -r 512 --vcpus=1 -f /vmware/RHEL5_1.img -d
--cdrom=/dev/cdrom --accelerate -v --vnc
  
Actual results:

as i did run the virt-install with debug, it gives quite a lot of output :

virt-install -n RHEL5_1 -r 512 --vcpus=1 -f /vmware/RHEL5_1.img -d
--cdrom=/dev/cdrom --accelerate -v --vnc


Starting install...
libvir: QEMU error :
Wed, 25 Jul 2007 18:48:48 DEBUG    Path is block file: Assuming Block disk type.
libvir: QEMU error :
Wed, 25 Jul 2007 18:48:48 DEBUG    Creating guest from '<domain type='kvm'>
  <name>RHEL5_1</name>
  <currentMemory>524288</currentMemory>
  <memory>524288</memory>
  <uuid>711e96be-6a0c-3b5e-f56e-1ac2bf525ca8</uuid>
  <os>
    <type arch='i386'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <apic/><acpi/><pae/>
  </features>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <vcpu>1</vcpu>
  <devices>
    <console device='pty'/>
    <disk type='file' device='disk'>
      <source file='/vmware/RHEL5_1.img'/>
      <target dev='hda'/>
    </disk>
    <disk type='block' device='cdrom'>
      <source dev='/dev/cdrom'/>
      <target dev='hdc'/>
      <readonly/>
    </disk>

    <interface type='network'>
      <source network='default'/>
      <mac address='00:16:ae:a0:75:ef'/>
    </interface>

    <graphics type='vnc' port='-1' />
  </devices>
</domain>
'
libvir: Remote error : socket closed unexpectedly
virDomainCreateLinux() failed socket closed unexpectedly
Domain installation may not have been
 successful.  If it was, you can restart your domain
 by running 'virsh start RHEL5_1'; otherwise, please
 restart your installation.
Wed, 25 Jul 2007 18:48:48 ERROR    virDomainCreateLinux() failed socket closed
unexpectedly
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 474, in <module>
    main()
  File "/usr/sbin/virt-install", line 438, in main
    dom = guest.start_install(conscb,progresscb)
  File "/usr/lib/python2.5/site-packages/virtinst/Guest.py", line 710, in
start_install
    return self._do_install(consolecb, meter)
  File "/usr/lib/python2.5/site-packages/virtinst/Guest.py", line 727, in
_do_install
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib/python2.5/site-packages/libvirt.py", line 521, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: virDomainCreateLinux() failed socket closed unexpectedly
libvir: Remote error : Broken pipe



Expected results:

it should start a vnc session and start the installation 


Additional info:

strace of libvirt while it's running attached
Comment 1 Sven Oehme 2007-07-25 13:10:48 EDT
Created attachment 159959 [details]
strace of libvirtd while its dying
Comment 2 Sven Oehme 2007-07-25 13:11:44 EDT
Created attachment 159960 [details]
virt-install debug output
Comment 3 Daniel Berrange 2007-07-25 13:14:07 EDT
Two known crash scenarios are fixed in the new 0.3.1 release of libvirt. It
should be in updates-testing already - can you upgrade, restart &  verify if it
fixes your problem
Comment 4 Sven Oehme 2007-07-25 13:17:16 EDT
3.1 is not in updates-testing yet, just double checked at
http://download.fedora.redhat.com/pub/fedora/linux/updates/testing/7/i386/ , but
i can check again tomorrow and verify ..
Comment 5 Sven Oehme 2007-07-26 05:28:03 EDT
i just tried the 3.1 package , same error, i attach a new strace and the output
of the virt-install command with the 3.1 package .. 
Comment 6 Sven Oehme 2007-07-26 05:28:54 EDT
Created attachment 160002 [details]
output of virt-install
Comment 7 Sven Oehme 2007-07-26 05:29:33 EDT
Created attachment 160003 [details]
strace of libvirtd while its dying
Comment 8 Daniel Berrange 2007-07-26 09:33:41 EDT
The strace doesn't look at all suspicious, and the command line install you have
works fine for me. So there must be some edge case I'm not tickling when trying
to reproduce. Can you try and get me a stack trace. eg 

  # yum --enablerepo=fedora-debuginfo install glibc-debuginfo libvirt-debuginfo
  # /etc/init.d/libvirtd stop
  # gdb /usr/sbin/libvirtd
   (gdb) run
   ...wait for crash...
   (gdb) bt

Comment 9 Sven Oehme 2007-07-26 10:11:48 EDT
gdb /usr/sbin/libvirtd
GNU gdb Red Hat Linux (6.6-15.fc7rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /usr/sbin/libvirtd
[Thread debugging using libthread_db enabled]
[New Thread -1208617280 (LWP 3762)]
[Detaching after fork from child process 3765. (Try `set detach-on-fork off'.)]
[Detaching after fork from child process 3769.]
[Detaching after fork from child process 3770.]
[Detaching after fork from child process 3771.]
[Detaching after fork from child process 3774.]
[Detaching after fork from child process 3775.]
[Detaching after fork from child process 3776.]
[Detaching after fork from child process 3779.]
[Detaching after fork from child process 3780.]
[Detaching after fork from child process 3781.]
[Detaching after fork from child process 3782.]
[Detaching after fork from child process 3783.]
[Detaching after fork from child process 3784.]
[Detaching after fork from child process 3785.]
[Detaching after fork from child process 3786.]
[Detaching after fork from child process 3788.]
[Detaching after fork from child process 3790.]
[Detaching after fork from child process 3794.]
[Detaching after fork from child process 3795.]
[Detaching after fork from child process 3796.]
[Detaching after fork from child process 3799.]
[Detaching after fork from child process 3800.]
libvir: QEMU error :
libvir: QEMU error :

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208617280 (LWP 3762)]
0x003e3473 in strlen () from /lib/libc.so.6
(gdb) bt
#0  0x003e3473 in strlen () from /lib/libc.so.6
#1  0x00164b77 in qemudParseVMDef (conn=0x9ad5500, driver=0x9ad7268,
    xmlStr=0x9ad8408 "<domain type='kvm'>\n  <name>RHEL5_1</name>\n 
<currentMemory>524288</currentMemory>\n  <memory>524288</memory>\n  <uuid>c31a1
             4ce-8a6e-d92b-f384-4cca9785b82a</uuid>\n  <os>\n    <type
arch='i386'>hvm</type>"..., displayName=0x0) at qemu_conf.c:1091
#2  0x00161304 in qemudDomainCreate (conn=0x9ad5500,
    xml=0x9ad8408 "<domain type='kvm'>\n  <name>RHEL5_1</name>\n 
<currentMemory>524288</currentMemory>\n  <memory>524288</memory>\n 
<uuid>c31a14ce              -8a6e-d92b-f384-4cca9785b82a</uuid>\n  <os>\n   
<type arch='i386'>hvm</type>"..., flags=0) at qemu_driver.c:1774
#3  0x00134bab in virDomainCreateLinux (conn=0x9ad5500, xmlDesc=0x0, flags=0) at
libvirt.c:803
#4  0x080540ac in remoteDispatchDomainCreateLinux (client=0xb7f1e008,
req=0xbfc16a70, args=0x0,
    ret=0xbfc16e80) at remote.c:760
#5  0x0804fbf9 in remoteDispatchClientRequest (server=0x9ad1028,
client=0xb7f1e008) at remote.c:143
#6  0x0804bb51 in qemudDispatchClientEvent (fd=11, events=1, opaque=0x9ad1028)
at qemud.c:1171
#7  0x080546a2 in virEventRunOnce () at event.c:331
#8  0x0804d2a5 in main (argc=Cannot access memory at address 0x0
) at qemud.c:1373
#9  0x0038af70 in __libc_start_main (main=0x804cd70 <main>, argc=1,
ubp_av=0xbfc17334,
    init=0x8054ba0 <__libc_csu_init>, fini=0x8054b90 <__libc_csu_fini>,
rtld_fini=0x11e3d0 <_dl_fini>,
    stack_end=0xbfc1732c) at libc-start.c:222
---Type <return> to continue, or q <return> to quit---
#10 0x0804ae31 in _start ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y
root@xxxx:~#

Comment 10 Daniel Berrange 2007-07-26 10:18:00 EDT
Ok there's two bugs here.  First virt-install is mistakenly passing arch 'i386'
instead of 'i686', second libvirt isn't checking for a bogus arch. I'll fix both
these bugs.

As a workaround in the meantime use  --arch i686 on the virt-install command line. 
Comment 11 Daniel Berrange 2007-07-26 10:24:30 EDT
Created attachment 160024 [details]
Fix check for bogus architecture
Comment 12 Daniel Veillard 2007-07-26 14:45:48 EDT
There should be a libvirt-0.3.1-2.fc7 available on F-7 Update Testing within
the next day,

Daniel
Comment 13 Daniel Veillard 2007-08-06 11:52:35 EDT
Sven, can you confirm that libvirt-0.3.1-2.fc7 which was pushed as a normal
libvirt update for F-7 last week fixes the problem for you ?

  thanks

Daniel
Comment 14 Sven Oehme 2007-08-06 12:13:35 EDT
yes, it works .. thanks