Raspberry Pi QEMU Fedora (solved)

Updated for Fedora 31 (25 Nov 2019)

The description here has been updated again, however, it now covers 64 bit installation. For the most part it's now smooth sailing. The defaults sizes chosen reflect the capacity of the new Ryzen based desktop, which is a quantum leap over the old quad CPU Intel machines. You might need to vary things like memory and CPUs depending on your circumstances.

Updated for Fedora 30 (26 June 2019)

If you're here it's because you're tearing your hair out trying to get past the timeouts and "no disk attached" error (F29, F30 times out but a different error) when running ARM32 images under QEMU on an Intel host machine.

Essentially this is a new known bug which, at release time (F29), wasn't considered to be a show stopper (but you're blocked - right?). It's been deemed to not be a show stopper because you can do the following to make it work (but it's not documented anywhere, hence this page).

You're most likely following this (or something very similar):
https://fedoraproject.org/wiki/Architectures/ARM/F28 /Installation#For_Versatile_Express_Emulation_with_QEMU

and the result is:
https://bugzilla.redhat.com/show_bug.cgi?id=1633328

The only way around this is to add the mystical command option:
--qemu-commandline=' -machine highmem=off'

Before going on, these are the steps that worked here to get all the necessary files extracted from an image downloaded from this link:

https://dl.fedoraproject.org/pub/fedora-secondary/releases/31/Spins/aarch64/images/Fedora-Minimal-31-1.9.aarch64.raw.xz

Once the image is downloaded it needs to be extracted to the image location.

mkdir -p ~/VirtLib_VMs/f31arm64
cd ~/VirtLib_VMs/f31arm64
cat ~/Downloads/Fedora-Minimal-31-1.9.aarch64.raw.xz | unxz -c > Fedora-Minimal-arm64-31.sda.raw

Somewhere along the line this was installed (a prerequisite):

dnf install -y libguestfs-tools
dnf install -y virt-install

Next the kernel image and initramfs need to be extracted from the raw image so QEMU can use it to launch.

[phillb@ryzen f31arm64]$ virt-builder --get-kernel ./Fedora-Minimal-arm64-31.sda.raw

download: /boot/vmlinuz-5.3.7-301.fc31.aarch64 -> ./vmlinuz-5.3.7-301.fc31.aarch64
download: /boot/initramfs-5.3.7-301.fc31.aarch64.img -> ./initramfs-5.3.7-301.fc31.aarch64.img
[phillb@ryzen f31arm64]$ ls -lsah
total 1.6G
4.0K drwxr-x---. 2 phillb phillb 4.0K Nov 25 14:03 .
4.0K drwxr-x---. 3 phillb phillb 4.0K Nov 25 13:36 ..
1.5G -rw-rw----. 1 phillb phillb 5.0G Nov 25 13:42 Fedora-Minimal-arm64-31.sda.raw
 50M -rw-rw----. 1 phillb phillb  50M Nov 25 14:03 initramfs-5.3.7-301.fc31.aarch64.img
8.7M -rw-rw----. 1 phillb phillb 8.7M Nov 25 14:03 vmlinuz-5.3.7-301.fc31.aarch64

Commandline install of the VM is(was) the only option with a spec like so (i.e. put this in a shell script file and then run: also note that the 32 bit install used to need --qemu-commandline='-machine highmem=off')

#!/bin/bash
virt-install \
  --name Fedora-minimal-arm64-31 \
  --ram 8192 \
  --arch aarch64 \
  --import \
  --os-variant fedora31 \
  --disk /home/phillb/VirtLib_VMs/f31arm64/Fedora-Minimal-arm64-31.sda.raw \
  --boot kernel=/home/phillb/VirtLib_VMs/f31arm64/vmlinuz-5.3.7-301.fc31.aarch64,initrd=/home/phillb/VirtLib_VMs/f31arm64/initramfs-5.3.7-301.fc31.aarch64.img,kernel_args="console=ttyAMA0 rw root=/dev/vda3 rootwait" \
  --boot uefi