Problem
On macOS, both autostart plist templates (io.lima-vm.autostart.INSTANCE.plist for LaunchAgent and io.lima-vm.daemon.INSTANCE.plist for LaunchDaemon) use RunAtLoad but do not include KeepAlive. If the Lima host agent process exits unexpectedly (crash, signal, OOM), launchd does not restart it. For example, it's left in a Broken state until the next login (LaunchAgent) or reboot (LaunchDaemon), and limactl start fails with a stale ha.sock error:
FATA[0000] errors inspecting instance: [failed to get Info from "~/.lima/k3s/ha.sock":
Get "http://lima-hostagent/v1/info": dial unix ~/.lima/k3s/ha.sock: connect: connection refused]
The LaunchDaemon case (--condition=boot) is especially relevant: the point of boot-time startup is generally unattended operation.
Proposed fix
Add <key>KeepAlive</key><true/> to both plist templates:
<key>KeepAlive</key>
<true/>
launchd's built-in throttling prevents spin loops on repeated crashes, so this should be safe to enable unconditionally.
Questions
- Is
KeepAlive: true appropriate for the LaunchAgent case as well, or should it be limited to the LaunchDaemon?
- Should this be an option exposed via
limactl autostart enable, or always on?
Related: #4984 (adds the LaunchDaemon / --condition=boot support)
Problem
On macOS, both autostart plist templates (
io.lima-vm.autostart.INSTANCE.plistfor LaunchAgent andio.lima-vm.daemon.INSTANCE.plistfor LaunchDaemon) useRunAtLoadbut do not includeKeepAlive. If the Lima host agent process exits unexpectedly (crash, signal, OOM), launchd does not restart it. For example, it's left in aBrokenstate until the next login (LaunchAgent) or reboot (LaunchDaemon), andlimactl startfails with a staleha.sockerror:The LaunchDaemon case (
--condition=boot) is especially relevant: the point of boot-time startup is generally unattended operation.Proposed fix
Add
<key>KeepAlive</key><true/>to both plist templates:launchd's built-in throttling prevents spin loops on repeated crashes, so this should be safe to enable unconditionally.
Questions
KeepAlive: trueappropriate for the LaunchAgent case as well, or should it be limited to the LaunchDaemon?limactl autostart enable, or always on?Related: #4984 (adds the LaunchDaemon /
--condition=bootsupport)