lima-vm/lima · error

failed to write temp plist: %w

Error message

failed to write temp plist: %w

What it means

daemonInstall renders the launchd plist and writes it to the os.CreateTemp file; this error wraps a short or failed write (tmp.Write returned an error). It indicates the temp file descriptor became unwritable after creation — typically disk-full or an I/O error.

Source

Thrown at cmd/limactl/autostart_darwin.go:124

		"Instance": instName,
		"WorkDir":  workDir,
		"UserName": userName,
	}
	if keepAlive {
		vars["KeepAlive"] = "true"
	}
	content, err := textutil.ExecuteTemplate(launchd.DaemonTemplate, vars)
	if err != nil {
		return fmt.Errorf("failed to render daemon plist: %w", err)
	}

	tmp, err := os.CreateTemp("", "io.lima-vm.daemon.*.plist")
	if err != nil {
		return fmt.Errorf("failed to create temp file: %w", err)
	}
	defer os.Remove(tmp.Name())
	if _, err := tmp.Write(content); err != nil {
		return fmt.Errorf("failed to write temp plist: %w", err)
	}
	tmp.Close()

	destPath := launchd.GetDaemonPlistPath(instName)
	svcTarget := "system/" + launchd.DaemonServiceNameFrom(instName)

	_ = runSudo(ctx, "launchctl", "bootout", svcTarget)
	if err := runSudo(ctx, "install", "-m", "644", tmp.Name(), destPath); err != nil {
		return fmt.Errorf("failed to install plist to %s: %w", destPath, err)
	}
	if err := runSudo(ctx, "launchctl", "enable", svcTarget); err != nil {
		return fmt.Errorf("failed to enable LaunchDaemon: %w", err)
	}
	if err := runSudo(ctx, "launchctl", "bootstrap", "system", destPath); err != nil {
		return fmt.Errorf("failed to bootstrap LaunchDaemon: %w", err)
	}

	logrus.Infof("LaunchDaemon installed for instance %q (runs as %q at boot)", instName, userName)

View on GitHub (pinned to dd909d0973)

Solutions

  1. Check disk space with `df -h` and free space on the temp volume
  2. Retry the limactl autostart command after freeing space
  3. If TMPDIR points to a network/unstable volume, point TMPDIR back to the local disk

Example fix

// before: limactl autostart myinstance --condition=boot  (fails, disk full)
// after:  df -h && rm -rf ~/Library/Caches/bulk-data && limactl autostart myinstance --condition=boot
Defensive patterns

Strategy: validation

Validate before calling

avail=$(df -k "$TMPDIR" | awk 'NR==2 {print $4}')
if [ "$avail" -lt 1024 ]; then
  echo "Less than 1MB free on temp volume"; exit 1
fi

Prevention

When it happens

Trigger: Calling `limactl autostart <instance> --condition=boot` on macOS when writing the rendered plist bytes to the just-created temp file fails: disk quota/full volume, I/O error on the temp filesystem, or fd closed/limit issues.

Common situations: Root volume hitting capacity during install; APFS quota; flaky external TMPDIR on a network volume.

Related errors


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