Bug 1219198

Summary: libvirt: internal error: qemu does not support SGA [code=1 domain=10]
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: agedosier, berrange, clalancette, crobinso, itamar, jdenemar, jforbes, laine, libvirt-maint, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-07 14:05:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 910269    

Description Richard W.M. Jones 2015-05-06 19:52:54 UTC
Description of problem:

libvirt 1.2.15 in Rawhide fails to run the libguestfs appliance.
The domain XML is:

<domain type="qemu" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
  <name>guestfs-j3m2513w6s3ea75r</name>
  <memory unit="MiB">500</memory>
  <currentMemory unit="MiB">500</currentMemory>
  <vcpu>1</vcpu>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
  </clock>
  <os>
    <type>hvm</type>
    <kernel>/builddir/build/BUILD/libguestfs-1.29.40/tmp/.guestfs-1000/appliance.d/kernel</kernel>
    <initrd>/builddir/build/BUILD/libguestfs-1.29.40/tmp/.guestfs-1000/appliance.d/initrd</initrd>
    <cmdline>panic=1 console=ttyS0 udevtimeout=6000 udev.event-timeout=6000 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=vt100</cmdline>
    <bios useserial="yes"/>
  </os>
  <on_reboot>destroy</on_reboot>
  <devices>
    <controller type="scsi" index="0" model="virtio-scsi"/>
    <disk device="disk" type="file">
      <source file="/builddir/build/BUILD/libguestfs-1.29.40/tmp/libguestfsqlXIq0/scratch.1"/>
      <target dev="sda" bus="scsi"/>
      <driver name="qemu" type="raw" cache="unsafe"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>
    <disk type="file" device="disk">
      <source file="/builddir/build/BUILD/libguestfs-1.29.40/tmp/libguestfsqlXIq0/overlay2"/>
      <target dev="sdb" bus="scsi"/>
      <driver name="qemu" type="qcow2" cache="unsafe"/>
      <address type="drive" controller="0" bus="0" target="1" unit="0"/>
      <shareable/>
    </disk>
    <serial type="unix">
      <source mode="connect" path="/builddir/build/BUILD/libguestfs-1.29.40/tmp/libguestfsqlXIq0/console.sock"/>
      <target port="0"/>
    </serial>
    <channel type="unix">
      <source mode="connect" path="/builddir/build/BUILD/libguestfs-1.29.40/tmp/libguestfsqlXIq0/guestfsd.sock"/>
      <target type="virtio" name="org.libguestfs.channel.0"/>
    </channel>
  </devices>
  <qemu:commandline>
    <qemu:env name="TMPDIR" value="/builddir/build/BUILD/libguestfs-1.29.40/tmp"/>
  </qemu:commandline>
</domain>

The error is:

internal error: qemu does not support SGA [code=1 domain=10]

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

libvirt-1.2.15-1.fc23.x86_64
qemu-2:2.3.0-3.fc23.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Build libguestfs Fedora package from dist-git in Rawhide.

Actual results:

See the build log here:
http://koji.fedoraproject.org/koji/taskinfo?taskID=9668748

Comment 1 Richard W.M. Jones 2015-05-06 19:54:46 UTC
I think it's this XML element:
    <bios useserial="yes"/>
which is triggering the libvirt failure.

Comment 2 Cole Robinson 2015-05-06 20:35:31 UTC
FWIW I just tried adding <bios useserial="yes"/> to a VM on F22, running libvirt.git and libvirt 1.2.15 built from git, and it didn't reproduce

Comment 3 Richard W.M. Jones 2015-05-06 20:37:53 UTC
(In reply to Cole Robinson from comment #2)
> FWIW I just tried adding <bios useserial="yes"/> to a VM on F22, running
> libvirt.git and libvirt 1.2.15 built from git, and it didn't reproduce

I suspect this bug could be linked to bug 1219191, in which
case you might not see the bug unless you remove the
<os><type arch=...> (the arch attribute) from your XML.

Comment 4 Richard W.M. Jones 2015-05-06 20:40:12 UTC
Of course the other thing that occurs to me is this could
be a qemu bug, if sgabios has not been included or some dependency
has moved.

Comment 5 Jiri Denemark 2015-05-06 20:56:06 UTC
(In reply to Richard W.M. Jones from comment #3)
> (In reply to Cole Robinson from comment #2)
> > FWIW I just tried adding <bios useserial="yes"/> to a VM on F22, running
> > libvirt.git and libvirt 1.2.15 built from git, and it didn't reproduce
> 
> I suspect this bug could be linked to bug 1219191, in which
> case you might not see the bug unless you remove the
> <os><type arch=...> (the arch attribute) from your XML.

Not really. The check for SGA support is done when libvirt creates the command line for QEMU, while the error shown in bug 1219191 happens when QEMU is already running (i.e., the SGA check passed). So it's the other way around. If <bios useserial="yes"/> is removed, you would likely see the error from bug 1219191 even on rawhide.

Comment 6 Jiri Denemark 2015-05-06 20:58:17 UTC
(In reply to Cole Robinson from comment #2)
> FWIW I just tried adding <bios useserial="yes"/> to a VM on F22, running
> libvirt.git and libvirt 1.2.15 built from git, and it didn't reproduce

Thanks, this seems to confirm my suspicion that we likely report SGA as unsupported because it is not supported by QEMU from rawhide.

Comment 7 Richard W.M. Jones 2015-05-07 11:54:11 UTC
Finally I was able to resolve all the gnutls dependency problems
and install qemu & libvirt.  As this doesn't reproduce on my Rawhide
system I will repeat the Koji build to see if it fixes itself.

Comment 8 Richard W.M. Jones 2015-05-07 12:28:19 UTC
Same failure:
https://kojipkgs.fedoraproject.org//work/tasks/7671/9677671/build.log

Comment 9 Richard W.M. Jones 2015-05-07 13:50:32 UTC
Full log including the log of libvirtd:
https://kojipkgs.fedoraproject.org//work/tasks/8216/9678216/build.log

Comment 10 Richard W.M. Jones 2015-05-07 14:05:42 UTC
So what was happening is that qemu was choosing qemu-system-alpha
(essentially the first arch in the list).  Since qemu-system-alpha
doesn't support SGA, you get this error.

I have verified that Cole's fix for bug 1219191 also fixes this problem.

Therefore I am marking this as a duplicate.

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

Comment 11 Daniel Berrangé 2015-05-07 14:06:54 UTC
We can see the full list of caps libvirt extracted

aps '/builddir/.cache/libvirt/qemu/cache/capabilities/4b21437223cbdecdb4e776fe0bb40302a421554fc350bfbb986908518557721d.xml' for '/usr/bin/qemu-system-alpha' with (1431005638, 1431005658)
2015-05-07 13:48:41.117+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/87ec9299b933cd6b566ae822928e0c2effac281ced4939efcabd4bb8e6aa643b.xml' for '/usr/bin/qemu-system-arm' with (1431005637, 1431005658)
2015-05-07 13:48:41.254+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/a013a09a30bf35fbea5b0236d43e579da4a041eaea677bc2f449290e5b7a5d5e.xml' for '/usr/bin/qemu-system-aarch64' with (1431005640, 1431005658)
2015-05-07 13:48:41.385+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/7468d4cc96179096e1f0d36ff57c0bdbe0dec6d6d4d19d595efe576201dc9e07.xml' for '/usr/bin/qemu-system-cris' with (1431005639, 1431005658)
2015-05-07 13:48:41.515+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/f11008721aacc79c97e592178e61264d75be551864cd79cc41fe820e31262f27.xml' for '/usr/bin/qemu-system-i386' with (1431005638, 1431005658)
2015-05-07 13:48:41.813+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/e0d8fff7434f454a924cdaec7f23a99b9c31fb79996e371676a3a2d675277d45.xml' for '/usr/bin/qemu-system-lm32' with (1431005643, 1431005658)
2015-05-07 13:48:41.938+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/6f185fa01c51ba508ff8e75421e02b82053c3ebbe2acce77ed3c1772a5ad395e.xml' for '/usr/bin/qemu-system-m68k' with (1431005647, 1431005658)
2015-05-07 13:48:42.069+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/3b4aa2e96c8beff35a23c55885e3ceab0e96bd68d3086046281ff63c6781356a.xml' for '/usr/bin/qemu-system-microblaze' with (1431005643, 1431005658)
2015-05-07 13:48:42.184+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/dc8586db4ee7ec8dd97a1f390df64a1b8784a20690a2861b63673d04e1c8ee55.xml' for '/usr/bin/qemu-system-microblazeel' with (1431005643, 1431005658)
2015-05-07 13:48:42.313+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/3a103308fa27eaf89cdce3012d683c03992c32ed1f4ce0d021dee0b861a013c1.xml' for '/usr/bin/qemu-system-mips' with (1431005644, 1431005658)
2015-05-07 13:48:42.445+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/065697b54cace5750c81605e09ad550812a395badc1cfe6908dbb6212962ea20.xml' for '/usr/bin/qemu-system-mipsel' with (1431005646, 1431005658)
2015-05-07 13:48:42.579+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/dd1df1169130ace90ab0a84c9c9c5ef04ccb975ad1b1223186b7365f31278c42.xml' for '/usr/bin/qemu-system-mips64' with (1431005645, 1431005658)
2015-05-07 13:48:42.706+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/62083361a5e41939a82a3d2d25c4b1f750524b164b2e8b9db92bb101e18166f2.xml' for '/usr/bin/qemu-system-mips64el' with (1431005646, 1431005658)
2015-05-07 13:48:42.857+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/c53fc183ccc508bf479a4cf1aaf177cd01deec2fd538768f80424f86ce4593ed.xml' for '/usr/bin/qemu-system-ppc' with (1431005649, 1431005658)
2015-05-07 13:48:43.009+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/0ad54346623871452df24f8f1874a98f35e9ec442a178537598576e22c527d09.xml' for '/usr/bin/qemu-system-ppc64' with (1431005650, 1431005658)
2015-05-07 13:48:43.157+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/fc71922a33655f783c5f81d792e9d80a2ef61c052a160a8725f21a2a8b396375.xml' for '/usr/bin/qemu-system-ppcemb' with (1431005650, 1431005658)
2015-05-07 13:48:43.291+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/04f7ed9deb8a0351be750a8a1c4632481a4a0d230cc6a3a7b04048de811f77b3.xml' for '/usr/bin/qemu-system-s390x' with (1431005648, 1431005658)
2015-05-07 13:48:43.422+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/f7ac86dc1cb75a6fef7c6a75bdb4376a356454ee67fac93fb4212d674a69be64.xml' for '/usr/bin/qemu-system-sh4' with (1431005651, 1431005658)
2015-05-07 13:48:43.585+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/b3a57e99a43969756b075c47edc1e2f052f32867c3cdf5c5e296cbb45657f47d.xml' for '/usr/bin/qemu-system-sh4eb' with (1431005651, 1431005658)
2015-05-07 13:48:43.710+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/491db0c56c1ec4767e9318821abbd95265d89129e189f53034fb45f55eb45ae6.xml' for '/usr/bin/qemu-system-sparc' with (1431005651, 1431005658)
2015-05-07 13:48:43.843+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/06167c9b895ea7ab421df06e033dc9191e66e8c13ca1228e8268781460574cdb.xml' for '/usr/bin/qemu-system-sparc64' with (1431005651, 1431005658)
2015-05-07 13:48:43.969+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/e1caee7051f35870d7e8e4ab2c531b5f3d362fb42332ef2ad935123c82b04da1.xml' for '/usr/bin/qemu-system-unicore32' with (1431005649, 1431005658)
2015-05-07 13:48:44.107+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/926803a9278e445ec919c2b6cbd8c1c449c75b26dcb1686b774314180376c725.xml' for '/usr/bin/qemu-system-x86_64' with (1431005638, 1431005658)
2015-05-07 13:48:44.411+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/b5cd104190c35fb4be904c7a1b60334c076a6b9e2b1de71598f704cbb8c7e821.xml' for '/usr/bin/qemu-system-xtensa' with (1431005647, 1431005658)
2015-05-07 13:48:44.542+0000: 29361: debug : virQEMUCapsSaveCache:2847 : Saved caps '/builddir/.cache/libvirt/qemu/cache/capabilities/da2557db089d471f34cd87cca5f993e7a92c8fa664a3b33a0dce94b53b367a5c.xml' for '/usr/bin/qemu-system-xtensaeb' with (1431005647, 1431005658)


We also see a failure to probe qemu-kvm, which is exptected as koji lacks KVM

$ grep irQEMUCapsLogProbeFailur b.log 
2015-05-07 13:48:41.687+0000: 29361: warning : virQEMUCapsLogProbeFailure:3432 : Failed to probe capabilities for /usr/bin/qemu-kvm: internal error: QEMU / QMP failed: Could not access KVM kernel module: No such file or directory
2015-05-07 13:48:44.287+0000: 29361: warning : virQEMUCapsLogProbeFailure:3432 : Failed to probe capabilities for /usr/bin/qemu-kvm: internal error: QEMU / QMP failed: Could not access KVM kernel module: No such file or directory
2015-05-07 13:48:44.734+0000: 29343: warning : virQEMUCapsLogProbeFailure:3432 : Failed to probe capabilities for /usr/bin/qemu-kvm: internal error: QEMU / QMP failed: Could not access KVM kernel module: No such file or directory
2015-05-07 13:48:44.911+0000: 29343: warning : virQEMUCapsLogProbeFailure:3432 : Failed to probe capabilities for /usr/bin/qemu-kvm: internal error: QEMU / QMP failed: Could not access KVM kernel module: No such file 


The interesting bit is the VM startup which shows libvirt defaulting to the 'alpha' architecture instead of x86_64 !

2015-05-07 13:48:48.889+0000: 29339: debug : qemuProcessStart:4292 : vm=0x7f0ea40f5af0 name=guestfs-lhh7teuo4osf2t7u id=-1 pid=0
2015-05-07 13:48:48.889+0000: 29339: debug : qemuProcessStart:4318 : Beginning VM startup process
2015-05-07 13:48:48.889+0000: 29339: debug : qemuProcessStart:4332 : Generating paths
2015-05-07 13:48:48.889+0000: 29339: debug : qemuProcessStart:4341 : Setting current domain def as transient
2015-05-07 13:48:48.889+0000: 29339: debug : qemuProcessStart:4369 : Determining emulator version
2015-05-07 13:48:48.889+0000: 29339: debug : virQEMUCapsCacheLookup:3620 : Returning caps 0x7f0ea41ee5f0 for /usr/bin/qemu-system-alpha

This is a regression in libvirts code for picking default architecture, and in turn explains why SGA is not available.