Installing a Fedora Linux ARM VM from a Raw Image

+

Many professionals who work in Information Technology (IT) or software development use an ARM-based PC, such as an Apple Silicon Mac, Snapdragon Elite X Windows Copilot+ PC, or an ARM Linux workstation such as the System76 Thelio Astra. Similarly, many students learning IT or software development may also use an ARM-based PC. For all of these people, it’s commonplace to deploy Linux virtual machines (VMs) on a PC using hypervisor software to test cloud apps, host server software, or run specialized tools.

Since nearly all Linux distributions are available for the ARM architecture, you can download a DVD ISO image of the installation media for some Linux distribution, attach it to the virtual DVD drive in your hypervisor software, boot the system, and complete the installation. Installing Linux in a VM on an ARM-based PC is essentially the same process as on an Intel- or AMD-based PC.

Unfortunately, some Linux distributions are no longer providing ARM installation media in ISO format anymore, including the Fedora Workstation distribution I primarily use for productivity and development, as well as in the textbooks I write. When you navigate to the Fedora Workstation download page, you’re now presented with a raw.xz file only:

Raw.xz file

So why did Fedora stop making installation ISO images available for the ARM platform? It’s likely to support a wider range of systems, including smaller or embedded devices like the Raspberry Pi. Because these devices have limited ports, you typically write a raw image file that contains a preinstalled Linux distribution to a microSD card that can be physically inserted into the device itself.

Of course, installing an ARM-based Linux VM from a raw image file is possible… but you must use a different process in your hypervisor software. In this blog post, I’ll outline that process for running a Fedora Workstation ARM VM using:

  • UTM on an Apple Silicon Mac,
  • Hyper-V on a Snapdragon Elite X Windows Copilot+ PC, and
  • KVM/Qemu on an ARM Linux workstation.

Installing Fedora on an Apple Silicon Mac using UTM

On your Apple Silicon-based Mac, first download the UTM hypervisor from mac.getutm.app. Double-click UTM.dmg in your Downloads folder to mount it on your Desktop, and then double-click the UTM desktop icon. Drag the UTM app to your Applications folder. Finally, drag the UTM desktop icon to your Trash and delete UTM.dmg from your Downloads folder.

Next, you can download the latest Fedora raw.xz image for ARM (aarch64) systems. Double-click on the Fedora--version.aarch64.raw.xz file you downloaded to extract it to a new filename called Fedora-Workstation-version.aarch64.raw in the same location. Because the UTM wizard requires you select an ISO image, you’ll also need to download a sample dummy.iso file.

Now, open UTM, click + (Create a New Virtual Machine), and then click Virtualize.

  • At the Operating System screen, click Linux.
  • At the Linux screen, select Use Apple Virtualization and then click Browse under the Boot ISO Image section. Navigate to the dummy.iso image you downloaded earlier in Step 3 and click Open. Click Continue when finished.
  • At the Hardware screen, enter the amount in the Memory dialog box (e.g., 8192 for 8 GB) and click Continue.
  • At the Storage screen, enter the amount of storage you’d like to use for files in the Size dialog box (e.g., 32 GB) and click Continue.
  • At the Shared Directory screen, optionally specify a directory on your system for sharing files and click Continue.
  • At the Summary screen, supply a name (e.g., Fedora Workstation), select Open VM Settings, and click Save.

In the Fedora Workstation settings window that opens, note the two drives under the Drives section. One is for the dummy.iso image (237 KB), and the other is the one you created earlier (e.g., 32 GB).

  • Highlight the 237 KB drive image, click Delete and Delete again to remove it.
  • Click the New button underneath the other drive image to create a new storage device. Click Import, navigate to your Fedora-Workstation-version.aarch64.raw file, and click Open. Note that you now have a new drive (approx. 15 GB in size).
  • Click and drag your new 15 GB drive image such that it is displayed above the existing drive image and click Save when finished. Your finished result should resemble the following:

Drives in UTM

Now, you can highlight your Fedora Workstation VM in the UTM window and then click the Play icon to start it. Once Fedora Workstation has booted, you complete the brief Setup wizard to create a user account before you’re able to start using the system. If you open a shell and run the df -hT | grep vda command, you’ll notice a 15 GB disk (/dev/vda) that has the following system partitions:

  • /dev/vda1 EFI system partition mounted to /boot/efi (~600MB, vfat filesystem)
  • /dev/vda2 mounted to /boot (~1GB, ext4 filesystem)
  • /dev/vda3 mounted to / (remainder of the 15GB, btrfs filesystem with /home configured as a btrfs subfilesystem)

Since Fedora Workstation uses btrfs for the / filesystem, you can easily extend the space to include the available space on the second unused disk, available as /dev/vdb. To do this, run the fdisk /dev/vdb command and create a single partition that spans the whole disk (/dev/vdb1). Next, you can run btrfs device add /dev/vdb1 / to ensure the / filesystem spans the new partition you created. When you run the the df -hT | grep vda command again, you’ll see that the / filesystem size is the sum total of /dev/vda3 and /dev/vdb1.

Installing Fedora on a Windows Copilot+ PC using Hyper-V

If you are using a Snapdragon Elite X Windows Copilot+ PC, you’ll need to run ARM-based virtual machines using the Hyper-V hypervisor. If Hyper-V isn’t already installed, open PowerShell as Administrator and run the Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All command.

Since Hyper-V does not support raw disk images, you’ll need to first convert the raw disk image to vhdx format. First download the latest Fedora raw.xz image for ARM (aarch64) and then use a program such as WinZip to extract the Fedora-Workstation-version.aarch64.raw file within. Next, download and install the qemu-img program for Windows and run qemu-img convert -f raw -O vhdx -o subformat=dynamic Fedora-Workstation-version.aarch64.raw Fedora-Workstation-version.aarch64.vhdx to convert the raw image to vhdx format.

Following this, you can open Hyper-V Manager, and click New, Virtual Machine from the Action pane.

  • Click Next on the Before You Begin page.
  • Specify a name (e.g., Fedora Workstation) and location for the VM on the Specify Name and Location page and click Next.
  • Select Generation 2 on the Specify Generation page and click Next.
  • Specify the startup memory (e.g., 8192 for 8 GB) on the Assign Memory page, de-select the Dynamic Memory option and click Next.
  • Select your Default or External Virtual Switch on the Configure Networking page and click Next.
  • Select Use an existing virtual hard disk on the Connect Virtual Hard Disk page and click Browse. Navigate to your Fedora-Workstation-version.aarch64.vhdx and click Open. Click Next when finished.
  • Select Install an operating system later on the Installation Options page and click Finish.

Next, right-click your VM in Hyper-V Manager and click Settings. De-select the Secure Boot option under the Security section, reduce the number of virtual processors to 1 under the Processor section, and click OK. Finally, you can double-click your VM in Hyper-V Manager and click Start. Once Fedora Workstation has booted, complete the brief Setup wizard to create a user account and start using the system.

Unlike UTM, Hyper-V emulates a SAS storage device. So, if you open a shell and run the df -hT | grep sda command, you’ll notice a 15 GB /dev/sda with the same three system partitions:

  • /dev/sda1 mounted to /boot/efi
  • /dev/sda2 mounted to /boot
  • /dev/sda3 mounted to /

As with UTM, you can extend your / filesystem by adding a second storage device to your VM in Hyper-V. Click File, Settings in your VM window, and create a second vhdx file on your storage controller with a size of your choice (this will /dev/sdb in Fedora Workstation). Next, run fdisk /dev/sdb and create a single partition that spans the whole disk (/dev/sdb1). Finally, you can run btrfs device add /dev/sdb1 / to add the new partition to the / filesystem.

Installing Fedora on an ARM Linux Workstation using KVM/Qemu

If you already have Linux installed on an ARM-based PC, you still may have the need to run separate ARM-based Linux VMs. In this case, you’ll need to have the correct Qemu packages installed for your distribution (refer to your distribution’s documentation here, as Qemu package names vary between distributions). Next, you’ll need to obtain an EFI BIOS image for QEMU. This can be downloaded from the Internet, but is likely already installed somewhere on your distribution as part of another Qemu package.

Next, download the latest Fedora raw.xz image for ARM (aarch64) and run the unxz Fedora-Workstation-version.aarch64.raw.xz command to extract the Fedora-Workstation-version.aarch64.raw file within.

Finally, you can run a qemu-system-aarch64 command to start your virtual machine (or put this command in a shell script that you can easily execute or edit later on). For example, the following will start a native Fedora VM using 8 GB of RAM from the Fedora-Workstation-version.aarch64.raw image (the \ characters protect the return character to allow each option to be on its own line):

qemu-system-aarch64 \
    -display default \
    -m 8192 \
    -cpu max \
    -M virt \
    -bios QEMU_EFI.fd \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -drive format=raw file=Fedora-Workstation-version.aarch64.raw

As with UTM, the first storage device used by Qemu is shown as /dev/vda and will have the same three system partitions. If you’d like to extend your / filesystem by adding a second storage device, you can run the qemu-img command to create a qcow2 image file that can be added to your qemu-system-aarch64 command. For example, qemu-img create -f qcow2 disk2.qcow2 32G will create a 32 GB disk2.qcow2 file, and you can append the -drive file=disk2.qcow2,if=virtio,cache=writethrough option to your existing qemu-system-aarch64 command. Following this, you can run fdisk /dev/vdb to create a partition that spans the new disk, and then run btrfs device add /dev/vdb1 / to add this new partition to the / filesystem.