QEMU and Firmware Detection
Cubic relies on QEMU and UEFI firmware to create and run virtual machines. When you start a VM, Cubic automatically searches for these tools in standard locations. This page explains where Cubic looks and how to override the detected paths when needed.
How Cubic looks
Cubic builds a single ordered list of directories where QEMU may live:
CUBIC_QEMU_DIR(if set),every directory on your
PATH,the built-in fallback locations:
C:\Program Files\qemuon Windows, and/usr/bin,/usr/local/bin,/opt/homebrew/bin,/home/linuxbrew/.linuxbrew/binand/opt/local/binon Unix.
That list is used two ways. For the binaries, Cubic hands the list to QEMU
as its PATH (only for the child process, your own environment is left
untouched) and launches qemu-system-x86_64 / qemu-system-aarch64 /
qemu-img by name, letting the operating system resolve them. For the
firmware, Cubic finds the QEMU install from the same list and reads its
firmware descriptors (see below).
QEMU Binary
The binary name depends on the architecture of the virtual machine:
Architecture |
Binary |
|---|---|
amd64 |
|
arm64 |
|
Install QEMU if it is not already present:
Platform |
Command |
|---|---|
Debian / Ubuntu |
|
Fedora / RHEL |
|
Arch Linux |
|
openSUSE |
|
macOS (Homebrew) |
|
Windows |
|
On Linux the UEFI firmware (OVMF for amd64, AAVMF for arm64) is a separate package. The commands above install it alongside QEMU. On macOS (Homebrew) and Windows the firmware is bundled with QEMU.
Override
Set CUBIC_QEMU_DIR to the directory that holds your QEMU binaries. Cubic
puts it at the front of the search list (for the binaries and the firmware
lookup below):
$ CUBIC_QEMU_DIR=/opt/qemu/bin cubic start my-vm
qemu-img
Cubic runs qemu-img from the same QEMU install as the emulator. This tool is
used to create and resize virtual machine disk images. It is included with QEMU
on all platforms, so installing QEMU (see above) is enough.
UEFI Firmware
Cubic requires UEFI firmware to boot virtual machines. Rather than guessing
filenames, Cubic reads QEMU’s firmware descriptor files
(share/qemu/firmware/*.json, shipped by QEMU on Linux, Homebrew and Windows)
and selects the plain UEFI (pflash) firmware whose target matches the VM’s
architecture and machine (q35 for amd64, virt for arm64). Other
special-purpose variants (such as secure boot) are skipped.
The firmware file named by the chosen descriptor is then resolved relative to
the QEMU install (anchored on its share/ directory). This lets the
firmware that ships next to QEMU resolve even when the descriptor records an
absolute path that is not reachable, for example inside a confined snap, or in
a relocated Windows build. On Linux the firmware and its descriptor ship in a
separate package (ovmf / edk2, installed by the commands above). On
macOS (Homebrew) and Windows they are bundled with QEMU.
Where the firmware comes from, per setup:
Setup |
QEMU install prefix |
Firmware file |
|---|---|---|
Linux package manager |
|
|
snap (strict confinement) |
|
|
macOS Homebrew / MacPorts |
|
|
Windows (winget) |
|
|
Override
Point CUBIC_QEMU_DIR at a QEMU install and Cubic reads its firmware
descriptors, or set the per-architecture CUBIC_QEMU_FW_AMD64 /
CUBIC_QEMU_FW_ARM64 to use a specific firmware file directly:
$ CUBIC_QEMU_FW_AMD64=/opt/qemu/share/qemu/edk2-x86_64-code.fd cubic start my-vm
Environment Variable Reference
Variable |
Tool |
Description |
|---|---|---|
|
QEMU emulator, qemu-img and UEFI firmware |
Directory of the QEMU install. Placed at the front of the search list for
the binaries, and used to locate the |
|
UEFI firmware (amd64) |
Path to a specific amd64 UEFI firmware (CODE) file. Overrides descriptor-based firmware selection for amd64 VMs. |
|
UEFI firmware (arm64) |
Path to a specific arm64 UEFI firmware (CODE) file. Overrides descriptor-based firmware selection for arm64 VMs. |