[Bug 1996285] Re: [SRU] riscv64 images fail to boot with libvirt and u-boot-qemu in 22.10

Heinrich Schuchardt 1996285 at bugs.launchpad.net
Mon Nov 28 11:01:42 UTC 2022


SRU to Kinetic tested successfully.

Launching with the following definition get's us into U-Boot. The
command 'virtio scan' succeeds. But U-Boot does not have a virtio-scsi
driver. So the image does not boot.

<?xml version="1.0"?>
<domain type="qemu">
  <name>ubuntu22.10-riscv64</name>
  <os>
    <type arch="riscv64" machine="virt">hvm</type>
    <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
  </os>
  <memory unit="GiB">2</memory>
  <vcpu placement="static">4</vcpu>
  <devices>
    <emulator>usr/bin/qemu-system-riscv64</emulator>
    <disk type="file" device="disk" cache="none">
      <driver name="qemu" type="raw"/>
      <source file="/tmp/ubuntu-22.10-live-server-riscv64.img"/>
      <target dev="sda" bus="scsi"/>
    </disk>
    <controller type="scsi" model="virtio-scsi"/>
    <interface type="network">
      <source network="default"/>
      <target dev="vnet0"/>
    </interface>
    <console type="pty">
      <target type="serial" port="0"/>
    </console>
  </devices>
</domain>

With a change to the <target /> definition U-Boot's virtio-blk driver is
used and booting succeds.

<?xml version="1.0"?>
<domain type="qemu">
  <name>ubuntu22.10-riscv64</name>
  <os>
    <type arch="riscv64" machine="virt">hvm</type>
    <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
  </os>
  <memory unit="GiB">2</memory>
  <vcpu placement="static">4</vcpu>
  <devices>
    <emulator>usr/bin/qemu-system-riscv64</emulator>
    <disk type="file" device="disk" cache="none">
      <driver name="qemu" type="raw"/>
      <source file="/tmp/ubuntu-22.10-live-server-riscv64.img"/>
      <!-- <target dev="sda" bus="scsi"/> -->
      <target dev="vda" />
    </disk>
    <controller type="scsi" model="virtio-scsi"/>
    <interface type="network">
      <source network="default"/>
      <target dev="vnet0"/>
    </interface>
    <console type="pty">
      <target type="serial" port="0"/>
    </console>
  </devices>
</domain>

To actually use the installer we have to add a second drive:

<?xml version="1.0"?>
<domain type="qemu">
  <name>ubuntu22.10-riscv64</name>
  <os>
    <type arch="riscv64" machine="virt">hvm</type>
    <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
  </os>
  <memory unit="GiB">2</memory>
  <vcpu placement="static">4</vcpu>
  <devices>
    <emulator>usr/bin/qemu-system-riscv64</emulator>
    <disk type="file" device="disk" cache="none">
      <driver name="qemu" type="raw"/>
      <source file="/tmp/ubuntu-22.10-live-server-riscv64.img"/>
      <target dev="vda" />
    </disk>
    <disk type="file" device="disk" cache="none">
      <driver name="qemu" type="raw"/>
      <source file="/tmp/disk.img"/>
      <!-- <target dev="sda" bus="scsi"/> -->
      <target dev="vdb" />
    </disk>
    <controller type="scsi" model="virtio-scsi"/>
    <interface type="network">
      <source network="default"/>
      <target dev="vnet0"/>
    </interface>
    <console type="pty">
      <target type="serial" port="0"/>
    </console>
  </devices>
</domain>

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to u-boot in Ubuntu.
https://bugs.launchpad.net/bugs/1996285

Title:
  [SRU] riscv64 images fail to boot with libvirt and u-boot-qemu in
  22.10

Status in libvirt package in Ubuntu:
  Invalid
Status in u-boot package in Ubuntu:
  Fix Released
Status in u-boot source package in Kinetic:
  Fix Committed

Bug description:
  [ Impact ]

  U-Boot provides a driver for virtio PCIe devices. Due to a bug
  introduced in upstream U-Boot 2022.07 the enumeration of PCIe bars
  does not work correctly. This has lead to crashes when executing
  U-Boot's 'virtio scan' command.

  An upstream patch fixing the issue is available. This patch only
  changes the virtio- PCIe driver.

  [ Test Plan ]

  1. Download the RISC-V server install image for 22.10:
  https://cdimage.ubuntu.com/releases/22.10/release/ubuntu-22.10-live-
  server-riscv64.img.gz

  2. Decompress the file and save it to
  /var/lib/libvirt/images/ubuntu-22.10-live-server-riscv64.img

  3. Create a VM in libvirt with the following XML:

  cat << EOF > riscv-guest.xml
  <?xml version="1.0"?>
  <domain type="qemu">
    <name>ubuntu22.10-riscv64</name>
    <os>
      <type arch="riscv64" machine="virt">hvm</type>
      <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
    </os>
    <memory unit="GiB">2</memory>
    <vcpu placement="static">4</vcpu>
    <devices>
      <emulator>usr/bin/qemu-system-riscv64</emulator>
      <disk type="file" device="disk" cache="none">
        <driver name="qemu" type="raw"/>
        <source file="/var/lib/libvirt/images/ubuntu-22.10-live-server-riscv64.img"/>
        <target dev="sda" bus="scsi"/>
      </disk>
      <controller type="scsi" model="virtio-scsi"/>
      <interface type="network">
        <source network="default"/>
        <target dev="vnet0"/>
      </interface>
      <console type="pty">
        <target type="serial" port="0"/>
      </console>
    </devices>
  </domain>
  EOF

  4. Define the VM with "virsh define riscv-guest.xml"

  5. Start the VM with "virsh start ubuntu22.10-riscv64"

  6. Open the console with "virsh console ubuntu22.10-riscv64"

  7. Check if the image can be booted.

  [ Where problems could occur ]

  Only the virtio-pci driver is changed.
  The impact is limited to the u-boot-qemu package.

  In the worst case virtual machines using this driver would not boot.

  [ Other Info ]
   
  n/a

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1996285/+subscriptions




More information about the foundations-bugs mailing list