UTM is a Virtual Machine manager and host (similar to VirtualBox), which can be used on M1/x86_64 Macs as well as iOS devices.
Arch Linux ARM is a port of Arch Linux that runs on ARM devices.
This guide aims to help you install Arch Linux ARM into a UTM Virtual Machine. As Arch Linux ARM does not have ISO releases, this is slightly more complicated than installing standard Arch Linux onto an x86_64 system. This is the process this guide will go through: Create a VM with an Alpine Linux ISO, set up (but not install) Alpine Linux, then use the Alpine system to download the Arch Linux ARM release tar file and write it to the virtual disk.
# Create the VM #
If you do not already have UTM installed, download and install the file named UTM.dmg in the Assets dropdown on the releases page, or follow the iOS installation instructions if you’re using iOS.
Download the latest Alpine Linux ISO (aarch64
in the STANDARD
section) from the downloads page.
Open UTM and click “Create a New Virtual Machine”. This will open the New VM wizard. Use these settings (after each bullet point it will either move you to the next screen, or just click Next
):
Virtualize.
If you’re using iOS, select Emulate1. Or, since there is no advantage to using ARM vs x86_64, just follow the normal Arch install guide and create an x86_64 VM.
Linux
Click the
Browse
button below the “Boot ISO Image” prompt and select the Alpine ISO.If you’re on iOS, change the Architecture to
ARM64 (aarch64)
.Choose the amount of Memory and number of CPU cores you want to allocate to your VM. To have GPU acceleration using the device’s GPU, check the
Enable hardware OpenGL accleration (experimental)
checkbox.Select the size of the drive that you want to allocate. Note that you need at least 2G to successfully install Arch, but I recommend at least 5-10G if you want to install a graphical environment and other software.
Optional: choose a directory to share.
Select the name you want to give your VM, then click
Save
.
# Optional (v4.0 or later): Use a serial console for installation #
If you are on UTM version 4.0 or later, you can use a serial console, which will allow pasting commands from this tutorial during installation.
Click the Edit button on the VM, and click the New...
button under the Devices
section of the sidebar, then select Serial
. (If you are on iOS, the use the plus button at the top of the edit sheet). You can leave the settings as they are, or change the colors and font if you wish.
You can remove the Display device if you want, or just keep it around if you intend to install a graphical environment in the Arch Linux VM (you will have multiple windows on macOS, that’s fine if you’re okay with ignoring it).
# Set up Alpine Linux #
Click the play button to start the VM. Once it has finished booting, log in as root
, no password will be required.
Run service hwclock start
, then run setup-alpine
and use the following answers:
Select keyboard layout: [none]
: Choose the layout you use.Select variant (or 'abort')
: Select the variant of the keyboard layout you use.Enter system hostname (fully qualified form, e.g. 'foo.example.org') [localhost]
: Press<Enter>
to use the default oflocalhost
, this will not affect the hostname the Arch install will have.Which one do you want to initialize? (or '?' or 'done') [eth0]
: Press<Enter>
to use the default ofeth0
.Ip address for eth0? (or 'dhcp', 'none', '?') [dhcp]
: Press<Enter>
to use the default ofdhcp
.Do you want to do any manual network configuration? (y/n) [n]
: Press<Enter>
to use the default ofn
.New password:
: Type any password, it does not matter as this is not the password for the Arch install.Retype password:
: Retype the password.Which timezone are you in? ('?' for list) [UTC]
: Either type?
to get the list or type the name of the timezone you’re in if you know it.HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]
: Enter your proxy URL if you need one, otherwise press<Enter>
to use the default ofnone
.Which NTP client to run? ('busybox', 'openntpd', 'chrony', or 'none') [chrony]
: Press<Enter>
to use the default ofchrony
, the choice doesn’t matter as this is not the NTP client used in the Arch system.Enter mirror number (1-70) or URL to add (or r/f/e/done) [1]
: The mirror chosen does not really matter because only a small amount of software will be installed. Either press<Enter>
to use the default of1
, or typef
to find the fastest mirror, of type the number of the mirror you normally use.Setup a user? (enter a lower-case loginname, or 'no') [no]
: Press<Enter>
to use the default ofno
.Which SSH server? ('openssh', 'dropbear', or 'none') [openssh]
: Typenone
and press<Enter>
.Which disk(s) would you like to use? (or '?' for help or 'none') [none]
: Press<Enter>
to use the default ofnone
.Enter where to store configs ('floppy', 'usb', or 'none') [none]
: Press<Enter>
to use the default ofnone
.Enter apk cache directory (or '?' or 'none') [/var/cache/apk]
: Typenone
and press<Enter>
.
# Install needed packages #
Run apk add parted e2fsprogs curl libarchive-tools efibootmgr
.
Here’s what each package is used for:
parted
: Provides theparted
command to partition the disk.e2fsprogs
: Provides themkfs.ext4
command to format an ext4 filesystem.curl
: Thecurl
command is used to download the Arch Linux ARM release tar file.libarchive-tools
: It provides thebsdtar
command, used to extract the tar file onto the disk.efibootmgr
: A tool for managing UEFI boot entries.
# Partition the disk #
Note that this installation does not create a swap. It is probably easiest to use a swap file once you’ve fully installed Arch such that the partition numbers do not need to change.
Because this is a Virtual Machine, and it uses VirtIO, the disk device is accessible at /dev/vda
, instead of /dev/sda
like you might expect on physical hardware.
Run these commands to create the partitions on the disk:
- Create a GPT partition table:
parted /dev/vda -- mklabel gpt
- Create a 256M EFI System Partition:
parted /dev/vda -- mkpart '"EFI System Partition"' fat32 1MB 512MB
- Mark the EFI System Partition as
esp
:parted /dev/vda -- set 1 esp on
- Create the root partition:
parted /dev/vda -- mkpart '"Arch Linux root"' ext4 512MB 100%
- Verify that the partition table looks correct by running
parted /dev/vda -- print
. The output should look like this:
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 512MB 511MB EFI System Partition boot, esp
2 512MB 10.7GB 10.2GB Arch Linux root
# Format the filesystems #
Run mkfs.vfat -F 32 -n boot /dev/vda1
to format the EFI System Partition as FAT32, with a label of boot
.
Run mkfs.ext4 -L archlinux /dev/vda2
to format the second partition as ext4, with a label of archlinux
.
# Mount the filesystems #
Note that these instructions must be done in the order stated.
- Mount the ext4 root partition onto
/mnt/
by runningmount -t ext4 /dev/vda2 /mnt/
- Create the
/mnt/boot/
folder to mount the EFI System Partition by runningmkdir /mnt/boot/
- Mount the EFI System Partition onto
/mnt/boot/
by runningmount -t vfat /dev/vda1 /mnt/boot/
# Download the Arch Linux ARM release tar and write it to the disk #
In order to not run out of RAM, the tar file is piped directly to bsdtar
, and isn’t saved into the RAM filesystem.
Run curl -L http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz | bsdtar -xpC /mnt/
.
# Modify fstab
to automatically mount the EFI System Partition when booting #
The fstab
file is used to define how disk partitions should be mounted onto the file system.
Append a line to mount the EFI System Partition onto /boot
info the fstab
file by running this command: echo '/dev/vda1 /boot vfat defaults 0 2' >>/mnt/etc/fstab
.
Note that the “
” gaps in the above command are meant to be 4 spaces.
# Use efibootmgr
to add an Arch Linux boot entry #
The Arch Linux ARM kernel is built with EFISTUB support, so it can be used as a UEFI application and be used as an efibootmgr
loader. For more technical information, see the kernel documentation about The EFI Boot Stub.
Run efibootmgr --create --disk /dev/vda --part 1 --label "Arch Linux" --loader /Image --unicode 'console=tty1 quiet root=/dev/vda2 rw initrd=\initramfs-linux.img'
Here’s what all the options mean:
--create
: Create a new boot entry.--disk /dev/vda
: Specifies the disk that contains the loader (EFISTUB kernel).--part 1
: Specifies the partition on the disk that contains the loader.--label "Arch Linux"
: Sets the boot manager display label, which is shown in the boot picker.--loader /Image
: Sets the loader to use (in this case the EFISTUB kernel).--unicode 'console=tty1 quiet root=/dev/vda2 rw initrd=\initramfs-linux.img'
: Additional arguments passed to the loader (kernel), this is the kernel command line. It sets theconsole
for kernel output, enablesquiet
mode to not spew too much output, sets theroot
partition and mounts itrw
(read and write), and sets theinitramfs
to be used.
# Unmount the partitions #
Run umount /mnt/boot/
to unmount the EFI System Partition.
Run umount /mnt/
to unmount the root partition.
# Shut down the VM and remove the ISO #
Run poweroff
to shut down the VM.
Select the VM in UTM, click on the CD/DVD
picker and click on Clear
.
# Boot Arch Linux ARM! #
Now click on the play button and the VM should boot into Arch Linux ARM.
Log in as root
with the password root
. Run pacman-key --init
and pacman-key --populate archlinuxarm
, followed by updating the system with pacman -Syu
.
Even kernel updates should work properly due to /boot
being mounted and the EFI loaded looking for the correct kernel image.
At this point, you can follow the rest of the Arch install guide to do things like setting up the timezone and locale.
# Updates #
5 Apr - Use parted
for partitioning, add label when creating filesystems.
12 Oct - Instructions for installation on iOS, suggestion to use serial console on UTM 4.0 and later, add answers to setup-alpine
options new in 3.16, note format of gaps in fstab
entry.
# Credits #
Thanks to @taupiqueur (also @Taupiqueur on the UTM Discord Server) for the suggestions to use parted
and to label the filesystems.
Unless the Virtualize button is clickable for you (when UTM is installed with TrollStore). ↩︎