abiosoft/colima · warning

unable to enable qemu %s emulation: %w

Error message

unable to enable qemu %s emulation: %w

What it means

When binfmt emulation is enabled and the guest arch matches the host arch, Colima registers qemu binfmt handlers in the guest via core.SetupBinfmt so foreign-architecture containers can run. Failures are deliberately non-fatal: the error is logged with logrus.Warn (mentioning the arch) and the chain continues. Expect degraded cross-arch container execution, nothing else.

Source

Thrown at environment/vm/lima/lima.go:316

func (l *limaVM) addPostStartActions(a *cli.ActiveCommandChain, conf config.Config) {
	// setup dns
	a.Add(func() error {
		if err := l.setupDNS(conf); err != nil {
			return fmt.Errorf("error setting up DNS: %w", err)
		}
		return nil
	})

	// registry certs
	a.Add(l.copyCerts)

	// cross-platform emulation
	a.Add(func() error {
		// use binfmt when emulation is disabled i.e. host arch
		if conf.Binfmt != nil && *conf.Binfmt {
			if arch := environment.HostArch(); arch == environment.Arch(conf.Arch).Value() {
				if err := core.SetupBinfmt(l.host, l, environment.Arch(conf.Arch)); err != nil {
					logrus.Warn(fmt.Errorf("unable to enable qemu %s emulation: %w", arch, err))
				}
			}
		}

		if l.limaConf.VMOpts.VZOpts.Rosetta.Enabled {
			// enable rosetta
			err := l.Run("sudo", "sh", "-c", `stat /proc/sys/fs/binfmt_misc/rosetta || echo ':rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/mnt/lima-rosetta/rosetta:OCF' > /proc/sys/fs/binfmt_misc/register`)
			if err != nil {
				logrus.Warn(fmt.Errorf("unable to enable rosetta: %w", err))
				return nil
			}

			// disable qemu
			if err := l.RunQuiet("stat", "/proc/sys/fs/binfmt_misc/qemu-x86_64"); err == nil {
				err = l.Run("sudo", "sh", "-c", `echo 0 > /proc/sys/fs/binfmt_misc/qemu-x86_64`)
				if err != nil {
					logrus.Warn(fmt.Errorf("unable to disable qemu x86_84 emulation: %w", err))
				}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. If you don't need cross-architecture containers, disable it: `colima start --binfmt=false` (config `binfmt: false`) and the warning disappears.
  2. If needed, verify guest support: `colima ssh -- ls /proc/sys/fs/binfmt_misc` and mount it (`sudo mount -t binfmt_misc`) before retrying.
  3. Use the official Colima disk image, which ships the expected kernel modules/setup.
  4. Recreate the profile if the guest is in a bad state.

Example fix

# before
colima start   # warns: unable to enable qemu aarch64 emulation

# after (if cross-arch not needed)
colima start --binfmt=false
Defensive patterns

Strategy: fallback

Try / catch

Non-fatal by design (logrus.Warn): no catch needed. If cross-arch containers then fail, disable binfmt or fix guest binfmt_misc support.

Prevention

When it happens

Trigger: `colima start --arch host-arch` with binfmt enabled (default on some setups) while registering handlers in the guest fails: guest kernel lacks binfmt_misc, /proc/sys/fs/binfmt_misc is not mounted, register file read-only, or the setup script errors.

Common situations: Custom/minimal guest images without binfmt_misc; hardened kernels disabling misc mounts; users who never run foreign-arch images and can ignore it.

Related errors


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