From Fedora Project Wiki

ARM on x86 with libvirt/virt-manager

Summary

Fix running ARM VMs on x86 hosts using standard libvirt tools libvirt virsh, virt-manager and virt-install.

Owner

Current status

Detailed Description

qemu has an ARM emulator that works well and is actively used in the Fedora ARM effort. However libvirt and virt-manager currently have issues launching qemu-system-arm VMs, mostly by encoding x86 assumptions in the generated command line that cause qemu-system-arm to fail to start. Let's fix it!

Benefit to Fedora

  • ARM developers can now use virt-manager/libvirt to manage ARM VMs without having to hack around it
  • Fedora QA can use standard tools to test ARM in its bid for Primary Architecture
  • Packagers who want to do ARM work can use standard virt tools to run ARM VMs.
  • Enthusiasts who want to try out the Fedora ARM spin can use standard tools to try it in a VM.

Scope

  • Proposal owners:
  1. Fix issues in libvirt with generating qemu-system-arm command lines:
    • Fix launching vexpress-a9 (DONE)
    • Support virtio-mmio to enable virtio for vexpress (DONE)
    • TODO: vexpress-a15 support? need to figure out the correct qemu+fedora incantation
  2. virt-install support (DONE, see docs)
  3. virt-manager support
    • Basic setup support (DONE, see docs)
    • TODO: Improve the 'Create VM' wizard to handle the ARM case better
      • Move 'arch' selection to the first screen
      • Allow choosing machine type up front in first screen
      • UI for setting kernel/initrd in create wizard
  4. Figure out how to actually install a new ARM VM and not depend on pre-installed images.
  5. Figure out why graphical setup is busted


Upgrade/compatibility impact

N/A (not a System Wide Change)

How To Test

TBD when work is testable.

User Experience

N/A (not a System Wide Change)

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change)

Documentation

Follow the instructions here to get a pre-installed F19 ARM image, and extract the kernel/initrd/dtb: Architectures/ARM/F19/Installation#For_Versatile_Express_Emulation_with_QEMU

virt-install example:

sudo virt-install \
--name armvirtio --ram 1024 \
--arch armv7l --machine vexpress-a9 \
--boot kernel=/var/lib/libvirt/images/vmlinuz-3.9.5-301.fc19.armv7hl,initrd=/var/lib/libvirt/images/initramfs-3.9.5-301.fc19.armv7hl.img,dtb=/var/lib/libvirt/images/vexpress-v2p-ca9.dtb,kernel_args="console=ttyAMA0 rw root=/dev/vda3" \
--disk /var/lib/libvirt/images/Fedora-XFCE-armhfp-19-1-sda.raw \
--nographics --os-variant fedora19

Using virtio requires a dtb to be passed in, but a dtb isn't strictly required otherwise.

You should use the minimal image. However if you downloaded one of the graphical images (eg. XFCE) then you can clear the root password like so:

# virsh destroy armvirtio
# virt-rescue -d armvirtio
><rescue> mount /dev/sda3 /sysroot
><rescue> vi /sysroot/etc/passwd
... remove the 'x' after the root entry ...
><rescue> touch /sysroot/.autorelabel
><rescue> umount /sysroot
><rescue> exit

Reboot the guest again and access the console:

# virsh start armvirtio
# virsh console armvirtio

You can log in as root (no password) and run initial-setup to set up user accounts and so on.

Creating the VM with virt-manager is a bit more convoluted at the moment, the 'Scope' section details some improvements we can make before F20 GA. Steps:

  • 'New VM' wizard
  • 'Import existing disk image'
  • Point at the above referenced ARM image. Choose Fedora 19 as the OS
  • Fill in whatever for RAM and CPU
  • On the final page, click customize before install
  • Under advanced options, choose virt type 'qemu', arch 'armv7l'
  • Click 'finish'
  • In the 'customize' wizard, go to 'Overview', change machine type to 'vexpress-a9'
  • Go to 'Boot settings', under 'direct kernel boot', specify kernel, initrd, dtb, and kernel args as specified above
  • Remove the 'graphics' and 'video' device
  • Click 'begin installation'

Release Notes

ARM VMs can now be run on x86 hosts using standard libvirt tools like virsh, virt-manager, and virt-install.