abiosoft/colima · error

binfmt not found: %w

Error message

binfmt not found: %w

What it means

Before installing, SetupBinfmt verifies the guest has the helper by running 'command -v binfmt' via guest.RunQuiet; failure is reported as 'binfmt not found'. Because RunQuiet failures are indistinguishable, a broken guest channel produces the same message as an image that genuinely lacks /usr/bin/binfmt.

Source

Thrown at core/core.go:39

)

// SetupBinfmt downloads and install binfmt
func SetupBinfmt(host hostActions, guest guestActions, arch environment.Arch) error {
	qemuArch := environment.AARCH64
	if arch.Value().GoArch() == "arm64" {
		qemuArch = environment.X8664
	}

	install := func() error {
		if err := guest.Run("sh", "-c", "sudo QEMU_PRESERVE_ARGV0=1 /usr/bin/binfmt --install 386,"+qemuArch.GoArch()); err != nil {
			return fmt.Errorf("error installing binfmt: %w", err)
		}
		return nil
	}

	// validate binfmt
	if err := guest.RunQuiet("command", "-v", "binfmt"); err != nil {
		return fmt.Errorf("binfmt not found: %w", err)
	}

	return install()
}

// LimaVersionSupported checks if the currently installed Lima version is supported.
func LimaVersionSupported() error {
	var values struct {
		Version string `json:"version"`
	}
	var buf bytes.Buffer
	cmd := cli.Command("limactl", "info")
	cmd.Stdout = &buf

	if err := cmd.Run(); err != nil {
		return fmt.Errorf("error checking Lima version: %w", err)
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Recreate the VM so the current default image ships binfmt: colima delete && colima start --arch <arch>
  2. Upgrade colima (brew upgrade colima) so provisioning includes current guest tooling
  3. Confirm manually: colima ssh -- command -v binfmt; if absent, update the image rather than patching it
  4. Avoid the cross-arch option when native architecture suffices

Example fix

# before
colima start --arch aarch64   # binfmt not found

# after
colima delete && colima start --arch aarch64
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the built-in probe before calling SetupBinfmt.
if err := guest.RunQuiet("command", "-v", "binfmt"); err != nil {
    // guest image lacks binfmt: recreate the VM with a current image
    // (colima delete && colima start) before cross-arch emulation
}

Try / catch

if err := core.SetupBinfmt(host, guest, arch); err != nil {
    if strings.Contains(err.Error(), "binfmt not found") {
        // image too old or guest unreachable: recreate VM, do not patch in place
    }
}

Prevention

When it happens

Trigger: 'colima start --arch <foreign>' where the guest image is old or slim and lacks the binfmt script, or the guest agent/SSH channel is down so command -v never executes successfully.

Common situations: Keeping a VM created by an older colima release after upgrading; pinned or custom guest images without the multiarch binfmt tooling; guest still booting when the check runs.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/fdd347772272d69a. Report an issue: GitHub.