Running Oracle Linux 9 with QEMU on an M1 Mac

June 28, 2022 | 3 minute read
Text Size 100%:

Updated with instructions for installing Oracle Linux 8 as well!

Oracle Linux 9 is now available! And since it includes both x86 and aarch64, that means you can try it out natively on ARM hardware like a Raspberry Pi or on Apple M1 silicon. This post explains how to run OL9 as a guest on the M1 Mac, accelerated by the MacOS hypervisor framework.

There are two easy ways to get Oracle Linux 9 up and running: QEMU directly, and via UTM for Mac.

Before you get started, first visit the download page to find the appropriate (Arm aarch64) Oracle Linux image. As of this writing, the latest Oracle Linux 9 release is 9.1, and you can directly download from this URL: https://yum.oracle.com/ISOS/OracleLinux/OL9/u1/aarch64/OracleLinux-R9-U1-aarch64-dvd.iso Click here for Oracle Linux 8 instructions.

Using UTM

  1. Install UTM from https://mac.getutm.app/ or from the App Store.
  2. Select Create new Virtual Machine, type Virtualized, OTHER, and input the location of your install ISO. Remember to unmount the ISO after the VM is installed.
  3. You can leave the rest of the defaults alone, and start your new virtual machine!

UTM Instructions

Using QEMU Directly

UTM uses QEMU under the hood, and if you like tinkering with things directly you can also install and call QEMU directly. These instructions also allow you to use BIOS binaries built and signed by Oracle Linux.

  1. Ensure you have Homebrew installed. Installation instructions for Homebrew
  2. brew install qemu and rpm2cpio:
      brew install rpm2cpio qemu
  3. You’ll also need an EFI BIOS image for QEMU, but you can get that from Oracle Linux too, with the following steps:
      curl -O https://yum.oracle.com/repo/OracleLinux/OL7/latest/aarch64/getPackage/AAVMF-1.5.1-1.el7.noarch.rpm
    rpm2cpio AAVMF-1.5.1-1.el7.noarch.rpm | cpio -ivd usr/share/AAVMF/AAVMF_{VARS,CODE}.fd
  4. Set up the flash images for your bios:
      dd if=/dev/zero of=pflash0.img bs=1m count=64
    dd if=/dev/zero of=pflash1.img bs=1m count=64
    dd if=usr/share/AAVMF/AAVMF_CODE.fd of=pflash0.img conv=notrunc
    dd if=usr/share/AAVMF/AAVMF_VARS.fd of=pflash1.img conv=notrunc
  5. Create a virtual disk for Oracle Linux (at least 10.8 GB):
      qemu-img create -f raw oraclelinux9.raw 20G
  6. Run the Oracle Linux installer!
      qemu-system-aarch64 \
        -monitor stdio \
        -M virt,highmem=off \
        -accel hvf \
        -cpu host \
        -smp 4 \
        -m 2048 \
        -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
        -drive file=pflash1.img,format=raw,if=pflash \
        -device virtio-gpu-pci \
        -display default,show-cursor=on \
        -device qemu-xhci \
        -device usb-kbd \
        -device usb-tablet \
        -device intel-hda \
        -device hda-duplex \
        -drive file=oraclelinux9.raw,format=raw,if=virtio,cache=writethrough \
        -net nic -net user \
        -cdrom OracleLinux-R9-U0-aarch64-dvd.iso

Depending on your MacOS version, you may be able to increase the amount of RAM beyond 2G by setting highmem=on, but this may cause problems on some versions of MacOS lower than 12.4. You can do this by setting -M virt, highmem=on and -m 4096 and keeping the other parameters the same.

Congratulations, you can now try out Oracle Linux 9 running in a guest!

 

Updated: Special Instructions for Oracle Linux 8

With the release of Oracle Linux 8.7 you can now natively run Oracle Linux 8 as a virtual guest on M1 silicon as well. Oracle Linux 8.7 is the first OL8 release to include UEK Release 7 (based on the 5.15 Linux kernel), which has a M1 compatible, 4k-pagesize kernel. Prior versions of OL8 shipped with UEK6, which include a 64k-pagesize kernel that is not compatible with the M1.  

The simplest way to ensure that you have a compatible system image is to do a fresh install with the full Oracle Linux 8.7 iso (~9GB), download here. Don't use the network install iso.  https://yum.oracle.com/ISOS/OracleLinux/OL8/u7/aarch64/OracleLinux-R8-U7-aarch64-dvd.iso

Verify that the booting kernel is 5.15 based and you have a fully working OL8 image ready to use!

grub must show a 5.15 kernel

 

Greg Marsden


Previous Post

Oracle Linux 9 Developer Preview image now available for OCI

Julie Wong | 3 min read

Next Post


Oracle Linux 8 receives IPv6 Ready Gold Logo and meets USGv6-r1 standards

David Gilpin | 2 min read