abiosoft/colima · error

error checking vmnet process: %w

Error message

error checking vmnet process: %w

What it means

Thrown by vmnetProcess.Alive() while Colima's daemon checks whether the rootful socket_vmnet process is healthy. If the pidfile exists, it runs `sudo /usr/bin/pkill -0 -F <pidfile>` (signal 0 = existence check only); a non-zero exit means the recorded process is dead, the pid was recycled, sudo failed, or pkill could not read the pidfile — all wrapped into this error.

Source

Thrown at daemon/process/vmnet/vmnet.go:49

		mode:         mode,
		netInterface: netInterface,
	}
}

type vmnetProcess struct {
	mode         string
	netInterface string
}

func (*vmnetProcess) Alive(ctx context.Context) error {
	info := Info()
	pidFile := info.PidFile
	socketFile := info.Socket.File()

	if _, err := os.Stat(pidFile); err == nil {
		cmd := exec.CommandContext(ctx, "sudo", "/usr/bin/pkill", "-0", "-F", pidFile)
		if err := cmd.Run(); err != nil {
			return fmt.Errorf("error checking vmnet process: %w", err)
		}
	}

	if _, err := os.Stat(socketFile); err != nil {
		return fmt.Errorf("vmnet socket file not found error: %w", err)
	}
	if n, err := net.Dial("unix", socketFile); err != nil {
		return fmt.Errorf("vmnet socket file error: %w", err)
	} else {
		if err := n.Close(); err != nil {
			logrus.Debugln(fmt.Errorf("error closing ping socket connection: %w", err))
		}
	}

	return nil
}

// Name implements process.BgProcess

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Restart cleanly: `colima stop --vz-rosetta` no — use `colima stop` then `colima start` so the daemon re-spawns vmnet and rewrites the pidfile
  2. Remove the stale pidfile: `sudo rm /opt/colima/run/vmnet-<profile>.pid` (check `pgrep -l socket_vmnet` first)
  3. If socket_vmnet keeps dying, capture logs: run colima with `--verbose` (sets DEBUG=1 for the daemon) and inspect output
  4. Reinstall the vmnet binaries if corrupted: `sudo rm -rf /opt/colima` then start again
  5. Escalate to the colima GitHub issues if the crash reproduces deterministically

Example fix

# before: stale pidfile makes Alive() fail
colima status   # reports vmnet down
# after
pgrep -l socket_vmnet || sudo rm -f /opt/colima/run/vmnet-*.pid
colima stop && colima start
Defensive patterns

Strategy: validation

Validate before calling

// Cheap liveness check without sudo/pkill
func vmnetLooksAlive(pidFile string) bool {
    b, err := os.ReadFile(pidFile)
    if err != nil {
        return false // no pidfile: Alive() skips the pkill check anyway
    }
    pid, err := strconv.Atoi(strings.TrimSpace(string(b)))
    if err != nil {
        return false // malformed pidfile will break pkill -F
    }
    p, err := os.FindProcess(pid)
    return err == nil && p != nil && p.Signal(syscall.Signal(0)) == nil
}

Try / catch

if err := vmnet.Alive(ctx); err != nil {
    if strings.Contains(err.Error(), "error checking vmnet process") {
        // pidfile exists but process is dead or sudo failed — treat as not-alive
        log.Debug("vmnet process check failed; assuming dead: ", err)
        _ = os.Remove(stalePidFileCleanup()) // after confirming process absence
    }
    // other Alive errors (socket) mean daemon needs restart
    return restartVmnetDaemon(ctx)
}

Prevention

When it happens

Trigger: The vmnet pidfile exists at /opt/colima/run/vmnet-<profile>.pid but the process is gone (crashed, was killed, machine rebooted); pidfile is stale and the pid now belongs to another process; sudo prompt cancelled during the check; /usr/bin/pkill missing (non-macOS, tampered system).

Common situations: socket_vmnet daemon crashed after a macOS update or sleep/wake cycle; leftover pidfile from an unclean `colima stop -f` or host reboot; user manually pkill'ed socket_vmnet; running colima on a host where /usr/bin/pkill path differs.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/df071265e4cead50. Report an issue: GitHub.