sp85qZoxf6
sp85qZoxf6

Reputation: 31

libvirt qemu-system-arm, error: XML error: No PCI buses available

I am trying to run a linux image i created with buildroot with libvirt.

If i use qemu-system-arm directly, everything works as intended:

/usr/bin/qemu-system-arm \
-M versatilepb \
-kernel output/images/zImage \
-dtb output/images/versatile-pb.dtb \
-drive index=0,file=output/images/rootfs.ext2,if=scsi,format=raw \
-append "root=/dev/sda console=ttyAMA0,115200" \
-net nic,model=rtl8139 \
-net user \
-nographic

However, when i try to create the xml from my qemu cmdline, it fails:

$ virsh domxml-from-native qemu-argv qemu.args                                                                     
error: XML error: No PCI buses available

I also tried to create a basic XML by hand:

<?xml version='1.0'?>
<domain type='qemu'>
        <name>Linux ARM</name>
        <uuid>ce1326f0-a9a0-11e3-a5e2-0800200c9a66</uuid>
        <memory>131072</memory>
        <currentMemory>131072</currentMemory>
        <vcpu>1</vcpu>
        <os>
                <type machine='versatilepb'>hvm</type>
                <kernel>zImage</kernel>
                <cmdline>root=/dev/sda console=ttyAMA0,115200</cmdline>
                <dtb>versatile-pb.dtb</dtb>
        </os>
        <devices>
                <disk type='file' device='disk'>
                        <source file='rootfs.ext2'/>
                        <target dev="sda" bus="scsi"/>
                </disk>
                <interface type='network'>
                        <source network='default'/>
                </interface>
        </devices>
</domain>

which fails with the same error:

$ virsh create guest-test.xml 
error: Failed to create domain from guest-test.xml
error: XML error: No PCI buses available

I already tried with the brand-new and latest libvirt-3.0.0, without any success

What do i need to change in my cmdline/xml?

Upvotes: 3

Views: 6316

Answers (1)

Ryan Goodfellow
Ryan Goodfellow

Reputation: 51

virsh domxml-from-native issue

The reason why the domxml-from-native command does not work is because the underlying code in libvirt that does the parsing expects the suffix of qemu-system- to be a canonical architecture name, and arm is not. In your case it would seem you want arm to map to armv7l which is a cannonical architecture name. You can pull this of by creating a soft-link qemu-system-armv7l that points you your system's qemu-system-arm and then use the location of the softlink in your qemu.args

code references

xml issues

Your xml is giving you the same error for multiple unrelated reasons. In the type element under os you need to specify arch="armv7l" (or some other canonical arm arch name). Note also that the kernel and dtb references need to be absolute paths or prefixed with a .. Finally some of the devices you have require a PCI bus and will not work with the machine you are going for. Consider the following alternative.

<domain type='qemu'>
  <name>Linux ARM</name>
  <uuid>ce1326f0-a9a0-11e3-a5e2-0800200c9a66</uuid>
  <memory>131072</memory>
  <currentMemory>131072</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch="armv7l" machine='versatilepb'>hvm</type>
    <kernel>/path/to/zImage</kernel>
    <cmdline>root=/dev/sda console=ttyAMA0,115200</cmdline>
    <dtb>/path/to/versatile-pb.dtb</dtb>
  </os>
  <devices>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"></driver>
      <source file="/path/to/root.qcow2"></source>
      <target dev="sda" bus="sd"></target>
    </disk>
    <serial type="tcp">
      <source mode="bind" host="localhost" service="4000"></source>
      <protocol type="telnet"></protocol>
    </serial>
  </devices>
</domain>

Upvotes: 3

Related Questions