lima-vm/lima · error

failed to force stop VM after installation: %w

Error message

failed to force stop VM after installation: %w

What it means

When RequestStop() reports success but the VM did not actually stop, installMacOS falls back to vm.Stop() (force stop). If that force stop also errors, this wrapped error is thrown, leaving the installer VM possibly still running.

Source

Thrown at pkg/driver/vz/vm_darwin_arm64.go:173

				bar.SetCurrent(int64(progress))
			}
		}
	}()

	err = installer.Install(ctx)
	bar.Finish()
	if err != nil {
		return err
	}

	stopped, err := vm.RequestStop()
	if err != nil {
		return fmt.Errorf("failed to stop VM after installation: %w", err)
	}
	if !stopped {
		logrus.WithError(err).Warn("VM did not stop after installation")
		if err = vm.Stop(); err != nil {
			return fmt.Errorf("failed to force stop VM after installation: %w", err)
		}
	}
	return nil
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Kill the leftover VM process (via Activity Monitor: search for the VM process) then retry `limactl start`
  2. Delete and recreate the instance: `limactl delete <name> --force`
  3. Reboot the Mac host to clear stuck Virtualization.framework state
  4. Update macOS to the latest release
Defensive patterns

Strategy: retry

Try / catch

if err := start(); err != nil && strings.Contains(err.Error(), "failed to force stop VM after installation") {
    // manually kill leftover VM processes, clean up, then retry
    killLeftoverVzProcesses()
    exec.Command("limactl", "delete", instName, "--force").Run()
    err = start()
}

Prevention

When it happens

Trigger: vm.RequestStop() returns stopped==false (VM ignored the graceful stop) and the subsequent vm.Stop() call returns an error during macOS installation.

Common situations: Guest hung during installation and refuses both graceful and forced shutdown; Virtualization.framework internal error; macOS host resource pressure.

Related errors


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