{"record":{"id":"cf27b72632dbd9c9","repo":"lima-vm/lima","slug":"no-machine-id-found-tried-v","errorCode":null,"errorMessage":"no machine-id found, tried %v","messagePattern":"no machine-id found, tried (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/osutil/machineid.go","lineNumber":58,"sourceCode":"\t\tioPlatformExpertDevice, err := ioPlatformExpertDeviceCmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn parseIOPlatformUUIDFromIOPlatformExpertDevice(bytes.NewReader(ioPlatformExpertDevice))\n\t}\n\n\tcandidates := []string{\n\t\t\"/etc/machine-id\",\n\t\t\"/var/lib/dbus/machine-id\",\n\t\t// We don't use \"/sys/class/dmi/id/product_uuid\"\n\t}\n\tfor _, f := range candidates {\n\t\tb, err := os.ReadFile(f)\n\t\tif err == nil {\n\t\t\treturn strings.TrimSpace(string(b)), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"no machine-id found, tried %v\", candidates)\n}\n\nfunc parseIOPlatformUUIDFromIOPlatformExpertDevice(r io.Reader) (string, error) {\n\tvar p plist.Plist\n\tdec := xml.NewDecoder(r)\n\tif err := dec.Decode(&p); err != nil {\n\t\treturn \"\", err\n\t}\n\tif p.Value.Dict == nil {\n\t\treturn \"\", errors.New(\"invalid plist: top-level value is not a dict\")\n\t}\n\tioRegistryEntryChildren, ok := p.Value.Dict[\"IORegistryEntryChildren\"]\n\tif !ok || ioRegistryEntryChildren.Array == nil || len(ioRegistryEntryChildren.Array) == 0 {\n\t\treturn \"\", errors.New(\"invalid plist: IORegistryEntryChildren not found or empty\")\n\t}\n\tfor _, child := range ioRegistryEntryChildren.Array {\n\t\tif child.Dict == nil {\n\t\t\tcontinue","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/osutil/machineid.go#L40-L76","documentation":"machineID() reads a list of platform-specific machine-ID files (e.g. /etc/machine-id, /var/lib/dbus/machine-id) and returns the first readable one. If none of the candidate files can be read, it returns this error listing every path it attempted. It exists so callers know exactly which locations were checked.","triggerScenarios":"All candidate files fail os.ReadFile — none exist, or all are permission-denied — when machineID() is invoked (typically during instance identity resolution, after which hostname fallback is used).","commonSituations":"Freshly provisioned minimal Linux containers (distroless, alpine without dbus) with no /etc/machine-id; running Lima from a systemd service with a hardened read-only filesystem; macOS builds where Linux paths don't apply and the IOPlatformUUID path also fails.","solutions":["Create a machine ID: `systemd-machine-id-setup` or write any unique hex string to /etc/machine-id.","Ensure the file is readable by the user running lima (chmod 444 /etc/machine-id).","For containers, mount one in: `docker run -v /etc/machine-id:/etc/machine-id:ro ...`.","Ignore the error if acceptable — the code falls back to hostname; verify hostname uniqueness instead."],"exampleFix":"// before\n$ ls /etc/machine-id\nls: cannot access '/etc/machine-id': No such file or directory\n// after\n$ systemd-machine-id-setup\n$ cat /etc/machine-id\n5f8a...c21","handlingStrategy":"fallback","validationCode":"candidates := []string{\"/etc/machine-id\", \"/var/lib/dbus/machine-id\"}\nfor _, f := range candidates {\n    if b, err := os.ReadFile(f); err == nil && strings.TrimSpace(string(b)) != \"\" {\n        // machine id available; safe to proceed\n        break\n    }\n}","typeGuard":null,"tryCatchPattern":"id, err := osutil.MachineID(ctx)\nif err != nil {\n    log.WithError(err).Warn(\"no machine-id, using hostname fallback\")\n}","preventionTips":["Run systemd-machine-id-setup at image build time","Mount /etc/machine-id read-only into containers","Treat the error as a warning — the library falls back to hostname"],"tags":["machine-id","linux","filesystem"],"backgroundTag":"missing-machine-id","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}