{"record":{"id":"1141783b33f88b77","repo":"abiosoft/colima","slug":"unable-to-enable-qemu-s-emulation-w","errorCode":null,"errorMessage":"unable to enable qemu %s emulation: %w","messagePattern":"unable to enable qemu (.+?) emulation: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"environment/vm/lima/lima.go","lineNumber":316,"sourceCode":"func (l *limaVM) addPostStartActions(a *cli.ActiveCommandChain, conf config.Config) {\n\t// setup dns\n\ta.Add(func() error {\n\t\tif err := l.setupDNS(conf); err != nil {\n\t\t\treturn fmt.Errorf(\"error setting up DNS: %w\", err)\n\t\t}\n\t\treturn nil\n\t})\n\n\t// registry certs\n\ta.Add(l.copyCerts)\n\n\t// cross-platform emulation\n\ta.Add(func() error {\n\t\t// use binfmt when emulation is disabled i.e. host arch\n\t\tif conf.Binfmt != nil && *conf.Binfmt {\n\t\t\tif arch := environment.HostArch(); arch == environment.Arch(conf.Arch).Value() {\n\t\t\t\tif err := core.SetupBinfmt(l.host, l, environment.Arch(conf.Arch)); err != nil {\n\t\t\t\t\tlogrus.Warn(fmt.Errorf(\"unable to enable qemu %s emulation: %w\", arch, err))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif l.limaConf.VMOpts.VZOpts.Rosetta.Enabled {\n\t\t\t// enable rosetta\n\t\t\terr := 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`)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Warn(fmt.Errorf(\"unable to enable rosetta: %w\", err))\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// disable qemu\n\t\t\tif err := l.RunQuiet(\"stat\", \"/proc/sys/fs/binfmt_misc/qemu-x86_64\"); err == nil {\n\t\t\t\terr = l.Run(\"sudo\", \"sh\", \"-c\", `echo 0 > /proc/sys/fs/binfmt_misc/qemu-x86_64`)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Warn(fmt.Errorf(\"unable to disable qemu x86_84 emulation: %w\", err))\n\t\t\t\t}","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/lima.go#L298-L334","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Custom/minimal guest images without binfmt_misc; hardened kernels disabling misc mounts; users who never run foreign-arch images and can ignore it.","solutions":["If you don't need cross-architecture containers, disable it: `colima start --binfmt=false` (config `binfmt: false`) and the warning disappears.","If needed, verify guest support: `colima ssh -- ls /proc/sys/fs/binfmt_misc` and mount it (`sudo mount -t binfmt_misc`) before retrying.","Use the official Colima disk image, which ships the expected kernel modules/setup.","Recreate the profile if the guest is in a bad state."],"exampleFix":"# before\ncolima start   # warns: unable to enable qemu aarch64 emulation\n\n# after (if cross-arch not needed)\ncolima start --binfmt=false","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"Non-fatal by design (logrus.Warn): no catch needed. If cross-arch containers then fail, disable binfmt or fix guest binfmt_misc support.","preventionTips":["Set --binfmt=false when cross-arch execution isn't needed","Ensure guest kernel exposes binfmt_misc","Use official images with expected modules"],"tags":["binfmt","qemu","emulation","guest","colima","non-fatal"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}