From 4a48e3d60b54d492526329ec26a8aebb13f5dad4 Mon Sep 17 00:00:00 2001 From: tolixx <1969733+tolixx@users.noreply.github.com> Date: Thu, 3 Dec 2026 18:59:14 +0100 Subject: [PATCH] Start virtual machines on ARM: add a USB controller and the virtio-gpu display The aarch64 virt machine has no USB controller of its own, so the tablet made libvirt refuse the domain ("USB is disabled for this domain"). ARM machines now get a qemu-xhci controller. ARM machines use virtio video, but qemu-base leaves virtio-gpu out. The installer now adds qemu-hw-display-virtio-gpu-pci and the base qemu-hw-display-virtio-gpu, which the -pci module needs but does not depend on: without it QEMU crashes while libvirt probes its devices. --- install.sh | 4 +++- omarchyd/machines.mjs | 2 +- test/install-arch.test.mjs | 4 ++-- test/machines.test.mjs | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 70785190..b6cd3b79 100755 --- a/install.sh +++ b/install.sh @@ -126,7 +126,9 @@ x86_64) vm_pkgs="qemu-base edk2-ovmf" ;; aarch64) vm_fw=edk2-aarch64 pacman -Si "$vm_fw" >/dev/null 2>&1 || pacman -Qi "$vm_fw" >/dev/null 2>&1 || vm_fw=qemu-system-arm-firmware - vm_pkgs="qemu-base qemu-system-aarch64 $vm_fw" + # The ARM virt machine has no VGA, so machines get a virtio-gpu display, which qemu-base leaves out. + # The -pci package needs the base one but does not depend on it, and without it QEMU crashes when libvirt probes it. + vm_pkgs="qemu-base qemu-system-aarch64 $vm_fw qemu-hw-display-virtio-gpu qemu-hw-display-virtio-gpu-pci" ;; *) die "My Own Data Center needs a 64-bit Intel, AMD or ARM computer; this one is $arch." ;; esac diff --git a/omarchyd/machines.mjs b/omarchyd/machines.mjs index fac30e78..d66b633d 100644 --- a/omarchyd/machines.mjs +++ b/omarchyd/machines.mjs @@ -642,7 +642,7 @@ function domainXml(m, kvm, uuid = '') { ${nic} - ${o.tablet === false ? '' : "\n "}${o.agent ? "\n " : ''} + ${arm && (o.tablet !== false || m.usbDevices?.length) ? "\n " : ''}${o.tablet === false ? '' : "\n "}${o.agent ? "\n " : ''} /dev/urandom ${(m.usbDevices ?? []).map((d) => hostdevXml(d)).join('\n ')}${m.nixos ? `\n ${nixosConfigFilesystemXml(configDir(dataDir, m.id))}` : ''} diff --git a/test/install-arch.test.mjs b/test/install-arch.test.mjs index b0ffbcf2..ec4edadd 100644 --- a/test/install-arch.test.mjs +++ b/test/install-arch.test.mjs @@ -31,9 +31,9 @@ test('x86-64 installs exactly the packages it always has', {skip}, async () => { }) test('aarch64 (Omarchy on an M1 Mac) is accepted and gets the ARM QEMU and firmware', {skip}, async () => { - assert.equal(await pick('aarch64', true), 'PKGS qemu-base qemu-system-aarch64 edk2-aarch64') + assert.equal(await pick('aarch64', true), 'PKGS qemu-base qemu-system-aarch64 edk2-aarch64 qemu-hw-display-virtio-gpu qemu-hw-display-virtio-gpu-pci') // Arch Linux ARM names the same firmware qemu-system-arm-firmware. - assert.equal(await pick('aarch64', false), 'PKGS qemu-base qemu-system-aarch64 qemu-system-arm-firmware') + assert.equal(await pick('aarch64', false), 'PKGS qemu-base qemu-system-aarch64 qemu-system-arm-firmware qemu-hw-display-virtio-gpu qemu-hw-display-virtio-gpu-pci') }) test('other processors are refused with a clear message', {skip}, async () => { diff --git a/test/machines.test.mjs b/test/machines.test.mjs index 9a869e5c..891c2e08 100644 --- a/test/machines.test.mjs +++ b/test/machines.test.mjs @@ -265,6 +265,7 @@ describe('omarchyd machines', () => { assert.match(seen.xml, //) assert.match(seen.xml, //) assert.match(seen.xml, //) + assert.doesNotMatch(seen.xml, /qemu-xhci/, 'q35 brings its own USB controller') assert.match(seen.xml, //) assert.match(seen.userData, /qemu-guest-agent/) assert.match(seen.userData, /python3/) @@ -1689,6 +1690,8 @@ test('on an ARM server (Omarchy on Apple Silicon) a machine is an aarch64 "virt" assert.match(xml, /<\/controller>/) assert.match(xml, /device='cdrom'>/) assert.match(xml, /