lima-vm/lima · warning
no machine-id found, tried %v
Error message
no machine-id found, tried %v
What it means
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.
Source
Thrown at pkg/osutil/machineid.go:58
ioPlatformExpertDevice, err := ioPlatformExpertDeviceCmd.CombinedOutput()
if err != nil {
return "", err
}
return parseIOPlatformUUIDFromIOPlatformExpertDevice(bytes.NewReader(ioPlatformExpertDevice))
}
candidates := []string{
"/etc/machine-id",
"/var/lib/dbus/machine-id",
// We don't use "/sys/class/dmi/id/product_uuid"
}
for _, f := range candidates {
b, err := os.ReadFile(f)
if err == nil {
return strings.TrimSpace(string(b)), nil
}
}
return "", fmt.Errorf("no machine-id found, tried %v", candidates)
}
func parseIOPlatformUUIDFromIOPlatformExpertDevice(r io.Reader) (string, error) {
var p plist.Plist
dec := xml.NewDecoder(r)
if err := dec.Decode(&p); err != nil {
return "", err
}
if p.Value.Dict == nil {
return "", errors.New("invalid plist: top-level value is not a dict")
}
ioRegistryEntryChildren, ok := p.Value.Dict["IORegistryEntryChildren"]
if !ok || ioRegistryEntryChildren.Array == nil || len(ioRegistryEntryChildren.Array) == 0 {
return "", errors.New("invalid plist: IORegistryEntryChildren not found or empty")
}
for _, child := range ioRegistryEntryChildren.Array {
if child.Dict == nil {
continueView on GitHub (pinned to dd909d0973)
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.
Example fix
// before $ ls /etc/machine-id ls: cannot access '/etc/machine-id': No such file or directory // after $ systemd-machine-id-setup $ cat /etc/machine-id 5f8a...c21
Defensive patterns
Strategy: fallback
Validate before calling
candidates := []string{"/etc/machine-id", "/var/lib/dbus/machine-id"}
for _, f := range candidates {
if b, err := os.ReadFile(f); err == nil && strings.TrimSpace(string(b)) != "" {
// machine id available; safe to proceed
break
}
} Try / catch
id, err := osutil.MachineID(ctx)
if err != nil {
log.WithError(err).Warn("no machine-id, using hostname fallback")
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- failed to register instance %#q to start at login: %w
- failed to get hostname: %w
- failed to create temp file: %w
- failed to write temp plist: %w
- --condition=boot is only supported on macOS
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/cf27b72632dbd9c9.
Report an issue: GitHub.