lima-vm/lima · error

could not find firmware for %#q (hint: try copying the `edk-

Error message

could not find firmware for %#q (hint: try copying the `edk-%s-code.fd` firmware to $HOME/.local/share/qemu/)

What it means

For non-x86_64 architectures (aarch64, armv7l, riscv64), getFirmware() probes known EDK2 firmware paths, including $HOME/.local/share/qemu/edk-<qemuArch>-code.fd. If no firmware file is found, it errors and tells the user to place the matching edk-<arch>-code.fd file there. The arch name in the hint is derived from the qemu binary name (qemu-system-<arch>).

Source

Thrown at pkg/driver/qemu/qemu.go:1335

		// Debian package "qemu-efi-riscv64"
		candidates = append(candidates, "/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd")
		// Fedora package "edk2-riscv64"
		candidates = append(candidates, "/usr/share/edk2/riscv/RISCV_VIRT_CODE.fd")
	}

	logrus.Debugf("firmware candidates = %v", candidates)

	for _, f := range candidates {
		if _, err := os.Stat(f); err == nil {
			return f, nil
		}
	}

	if arch == limatype.X8664 {
		return "", fmt.Errorf("could not find firmware for %#q (hint: try setting `firmware.legacyBIOS` to `true`)", arch)
	}
	qemuArch := strings.TrimPrefix(filepath.Base(qemuExe), "qemu-system-")
	return "", fmt.Errorf("could not find firmware for %#q (hint: try copying the `edk-%s-code.fd` firmware to $HOME/.local/share/qemu/)", arch, qemuArch)
}

var hasSMEDarwin = sync.OnceValue(func() bool {
	if runtime.GOOS != "darwin" || runtime.GOARCH != "arm64" {
		return false
	}
	// golang.org/x/sys/cpu does not support inspecting the availability of SME yet
	s, err := osutil.Sysctl(context.Background(), "hw.optional.arm.FEAT_SME")
	if err != nil {
		logrus.WithError(err).Debug("failed to check hw.optional.arm.FEAT_SME")
	}
	return s == "1"
})

func hasHostCPU(qemuVersion *semver.Version) bool {
	switch runtime.GOOS {
	case "darwin":
		if hasSMEDarwin() {

View on GitHub (pinned to dd909d0973)

Solutions

  1. Copy the matching firmware into $HOME/.local/share/qemu/ named `edk-<qemuArch>-code.fd` (e.g. `edk-aarch64-code.fd`), using the filename from the error message.
  2. Install the distro edk2/QEMU firmware package (e.g. `apt install qemu-efi-aarch64`, `brew install qemu`).
  3. Verify the qemu binary basename begins with `qemu-system-`; otherwise the derived qemuArch (and expected filename) will be wrong.

Example fix

# before: firmware missing
# after
cp /usr/share/qemu/edk2-aarch64-code.fd $HOME/.local/share/qemu/edk-aarch64-code.fd
Defensive patterns

Strategy: fallback

Validate before calling

qemuArch := "aarch64" // derive from binary name
fw := filepath.Join(home, ".local", "share", "qemu", fmt.Sprintf("edk-%s-code.fd", qemuArch))
if _, err := os.Stat(fw); err != nil {
    // prompt user to install/copy the edk2 firmware before starting the VM
}

Try / catch

if strings.Contains(err.Error(), "could not find firmware") && strings.Contains(err.Error(), "edk-") {
    // copy the referenced edk-<arch>-code.fd into $HOME/.local/share/qemu/ then retry
}

Prevention

When it happens

Trigger: Starting a QEMU instance with arch=aarch64/armv7l/riscv64 when no EDK2 firmware exists in the probed system paths or in $HOME/.local/share/qemu/edk-<arch>-code.fd.

Common situations: Apple Silicon Macs where an upgrade or nonstandard QEMU install removed/relocated edk2-arm-code.fd; missing edk2 package on Linux ARM hosts; custom qemu binaries whose basename prefix breaks the fallback lookup.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/6d00e3f308fc8b79. Report an issue: GitHub.