lima-vm/lima · error

failed to %s the autostart entry for instance %#q: %w

Error message

failed to %s the autostart entry for instance %#q: %w

What it means

startAtLoginAction wraps failures from autostart.RegisterToStartAtLogin with this message, using verb "create" for a new entry or "update" when one already exists. It means limactl could not install or update the autostart unit/agent that starts the instance at login.

Source

Thrown at cmd/limactl/start-at-login_unix.go:49

			return nil
		}
		return err
	}

	flags := cmd.Flags()
	startAtLogin, err := flags.GetBool("enabled")
	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

  1. Check write permissions on ~/.config/systemd/user (Linux) or ~/Library/LaunchAgents (macOS)
  2. Run `systemctl --user daemon-reload` manually to surface the underlying error
  3. Verify the instance exists and its directory is valid (`limactl list`)
  4. Free disk space / fix home-dir mount if writes are failing

Example fix

// before: missing directory
mkdir: no ~/.config/systemd/user
// after
mkdir -p ~/.config/systemd/user && limactl start-at-login default --enabled
Defensive patterns

Strategy: validation

Validate before calling

unit_dir="$HOME/.config/systemd/user"
mkdir -p "$unit_dir" && [ -w "$unit_dir" ] || { echo "cannot write $unit_dir" >&2; exit 1; }

Try / catch

if ! limactl start-at-login "$inst" --enabled 2>err.log; then
  cat err.log >&2; systemctl --user daemon-reload; exit 1
fi

Prevention

When it happens

Trigger: Running `limactl start-at-login <instance> --enabled` where RegisterToStartAtLogin fails writing the systemd user unit or launchd plist: permission errors in ~/.config/systemd/user or ~/Library/LaunchAgents, invalid instance paths, or `systemctl --user daemon-reload` failing.

Common situations: Read-only or quota-full home directory; SELinux/AppArmor blocking unit install; macOS LaunchAgents dir missing; broken dbus preventing daemon-reload; instance directory moved after creation.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/9b81daead6675cef. Report an issue: GitHub.