lima-vm/lima · error
failed to check autostart registration: %w
Error message
failed to check autostart registration: %w
What it means
While launching the host agent, Lima checks autostart.IsRegistered to decide whether to spawn the host agent in the foreground or let the autostart manager do it. A backend error other than autostart.ErrNotSupported aborts the start with this message.
Source
Thrown at pkg/instance/start.go:254
prepared, err := Prepare(ctx, inst, guestAgent)
if err != nil {
return err
}
if limactl == "" {
limactl, err = os.Executable()
if err != nil {
return err
}
}
haStdoutPath := filepath.Join(inst.Dir, filenames.HostAgentStdoutLog)
haStderrPath := filepath.Join(inst.Dir, filenames.HostAgentStderrLog)
begin := time.Now() // used for logrus propagation
var haCmd *exec.Cmd
if isRegisteredToAutoStart, err := autostart.IsRegistered(ctx, inst); err != nil && !errors.Is(err, autostart.ErrNotSupported) {
return fmt.Errorf("failed to check autostart registration: %w", err)
} else if !isRegisteredToAutoStart || launchHostAgentForeground {
if err := os.RemoveAll(haStdoutPath); err != nil {
return err
}
if err := os.RemoveAll(haStderrPath); err != nil {
return err
}
haStdoutW, err := os.Create(haStdoutPath)
if err != nil {
return err
}
// no defer haStdoutW.Close()
haStderrW, err := os.Create(haStderrPath)
if err != nil {
return err
}
// no defer haStderrW.Close()
View on GitHub (pinned to dd909d0973)
Solutions
- Ensure a systemd user session exists (systemctl --user status works) and enable lingering: loginctl enable-linger $USER.
- Run limactl from the same user session that owns the instance directory.
- On truly autostart-less platforms, the ErrNotSupported path is tolerated - if you get this error instead, the backend exists but is failing; fix the session/dbus environment.
- Alternative: limactl start --foreground (or the equivalent) to avoid the autostart decision path if available.
Example fix
// before ssh host "limactl start myvm" # no user session // after ssh host "loginctl enable-linger $USER && systemctl --user status && limactl start myvm"
Defensive patterns
Strategy: try-catch
Validate before calling
// confirm a user service manager is reachable before start
if err := exec.Command("systemctl", "--user", "is-system-running").Run(); err != nil && runtime.GOOS == "linux" {
log.Println("no systemd user session: start via autostart check may fail")
} Try / catch
err := instance.Start(ctx, inst, "")
if err != nil && strings.Contains(err.Error(), "check autostart registration") {
// retry in foreground path or after fixing the user session
err = startForeground(ctx, inst)
} Prevention
- Enable lingering so services survive without an interactive session
- Run limactl as the instance-owning user
- Keep dbus/systemd user instance healthy in CI images
- Prefer foreground start on hosts without autostart support
When it happens
Trigger: `limactl start <inst>` on a host where the launchd (macOS) or systemd user (Linux) query fails: no systemd user session, dbus unavailable, or launchd plist lookup error.
Common situations: Starting instances from CI/containers/SSH sessions without a user service manager; running limactl as a different user than the one with the session; minimal Linux installs without systemd.
Related errors
- 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 %s the autostart entry for instance %#q: %w
- failed to unregister the autostart entry for instance %#q: %
- failed to check if the autostart entry for instance %#q is r
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/9e07adb320216f13.
Report an issue: GitHub.