lima-vm/lima · error
failed to unregister the autostart entry for instance %#q: %
Error message
failed to unregister the autostart entry for instance %#q: %w
What it means
startAtLoginAction wraps failures from autostart.UnregisterFromStartAtLogin with this message when disabling autostart (--enabled not set). The registered check succeeded but actually removing the systemd user unit or launchd agent failed.
Source
Thrown at cmd/limactl/start-at-login_unix.go:56
if err != nil {
return err
}
if registered, err := autostart.IsRegistered(ctx, inst); err != nil {
return fmt.Errorf("failed to check if the autostart entry for instance %#q is registered: %w", inst.Name, err)
} else if startAtLogin {
verb := "create"
if registered {
verb = "update"
}
if err := autostart.RegisterToStartAtLogin(ctx, inst); err != nil {
return fmt.Errorf("failed to %s the autostart entry for instance %#q: %w", verb, inst.Name, err)
}
logrus.Infof("The autostart entry for instance %#q has been %sd", inst.Name, verb)
} else {
if !registered {
logrus.Infof("The autostart entry for instance %#q is not registered", inst.Name)
} else if err := autostart.UnregisterFromStartAtLogin(ctx, inst); err != nil {
return fmt.Errorf("failed to unregister the autostart entry for instance %#q: %w", inst.Name, err)
} else {
logrus.Infof("The autostart entry for instance %#q has been unregistered", inst.Name)
}
}
return nil
}
View on GitHub (pinned to dd909d0973)
Solutions
- Run `systemctl --user status lima-<instance>` (Linux) to see why disable/stop fails, then stop it manually
- Fix ownership/permissions of the autostart unit/plist (avoid managing it with sudo)
- Retry after ensuring a healthy user session: `systemctl --user daemon-reload`
- As a last resort remove the unit file (~/.config/systemd/user) or plist (~/Library/LaunchAgents) manually and daemon-reload
Example fix
// before: root-owned unit blocking removal sudo limactl start-at-login default # created root-owned files // after sudo chown -R $USER ~/.config/systemd/user && limactl start-at-login default
Defensive patterns
Strategy: try-catch
Validate before calling
systemctl --user is-failed 'lima-*' >/dev/null 2>&1 && systemctl --user reset-failed 'lima-*'
Try / catch
if ! limactl start-at-login "$inst" 2>err.log; then
grep -q 'unregister' err.log && {
systemctl --user daemon-reload
rm -f ~/.config/systemd/user/lima-*.service
limactl start-at-login "$inst"
}
fi Prevention
- Stop/inspect the service before unregistering if it is active or failed
- Keep unit files user-owned; avoid sudo-created autostart entries
- Run daemon-reload after manual edits to autostart units
When it happens
Trigger: Running `limactl start-at-login <instance>` without --enabled while a registered autostart entry exists, and UnregisterFromStartAtLogin fails: unit file deletion denied, `systemctl --user disable/stop` erroring, or launchd unload failing.
Common situations: Unit file manually edited/locked or owned by root after sudo misuse; service currently active and refusing stop; dbus/systemd user session degraded; macOS launchd unload errors due to label mismatch.
Related errors
- failed to %s the autostart entry for instance %#q: %w
- failed to check if the autostart entry for instance %#q is r
- failed to check if the autostart entry for instance %#q is r
- failed to check if the autostart entry for instance %#q is r
- failed to disable the autostart entry for instance %#q: %w
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/a476d99e9865cd64.
Report an issue: GitHub.