{"record":{"id":"fdd347772272d69a","repo":"abiosoft/colima","slug":"binfmt-not-found-w","errorCode":null,"errorMessage":"binfmt not found: %w","messagePattern":"binfmt not found: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/core.go","lineNumber":39,"sourceCode":")\n\n// SetupBinfmt downloads and install binfmt\nfunc SetupBinfmt(host hostActions, guest guestActions, arch environment.Arch) error {\n\tqemuArch := environment.AARCH64\n\tif arch.Value().GoArch() == \"arm64\" {\n\t\tqemuArch = environment.X8664\n\t}\n\n\tinstall := func() error {\n\t\tif err := guest.Run(\"sh\", \"-c\", \"sudo QEMU_PRESERVE_ARGV0=1 /usr/bin/binfmt --install 386,\"+qemuArch.GoArch()); err != nil {\n\t\t\treturn fmt.Errorf(\"error installing binfmt: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\t// validate binfmt\n\tif err := guest.RunQuiet(\"command\", \"-v\", \"binfmt\"); err != nil {\n\t\treturn fmt.Errorf(\"binfmt not found: %w\", err)\n\t}\n\n\treturn install()\n}\n\n// LimaVersionSupported checks if the currently installed Lima version is supported.\nfunc LimaVersionSupported() error {\n\tvar values struct {\n\t\tVersion string `json:\"version\"`\n\t}\n\tvar buf bytes.Buffer\n\tcmd := cli.Command(\"limactl\", \"info\")\n\tcmd.Stdout = &buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn fmt.Errorf(\"error checking Lima version: %w\", err)\n\t}\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/core/core.go#L21-L57","documentation":"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.","triggerScenarios":"'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.","commonSituations":"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.","solutions":["Recreate the VM so the current default image ships binfmt: colima delete && colima start --arch <arch>","Upgrade colima (brew upgrade colima) so provisioning includes current guest tooling","Confirm manually: colima ssh -- command -v binfmt; if absent, update the image rather than patching it","Avoid the cross-arch option when native architecture suffices"],"exampleFix":"# before\ncolima start --arch aarch64   # binfmt not found\n\n# after\ncolima delete && colima start --arch aarch64","handlingStrategy":"validation","validationCode":"// Mirror the built-in probe before calling SetupBinfmt.\nif err := guest.RunQuiet(\"command\", \"-v\", \"binfmt\"); err != nil {\n    // guest image lacks binfmt: recreate the VM with a current image\n    // (colima delete && colima start) before cross-arch emulation\n}","typeGuard":null,"tryCatchPattern":"if err := core.SetupBinfmt(host, guest, arch); err != nil {\n    if strings.Contains(err.Error(), \"binfmt not found\") {\n        // image too old or guest unreachable: recreate VM, do not patch in place\n    }\n}","preventionTips":["Recreate the VM after major colima upgrades so guest tooling stays current","Avoid pinning old guest images when using cross-arch emulation","Verify 'colima ssh -- command -v binfmt' succeeds before automating cross-arch builds"],"tags":["binfmt","guest","cross-arch","vm-image"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}