abiosoft/colima · error

error starting daemon: %w

Error message

error starting daemon: %w

What it means

Returned by daemonize (cmd/daemon/daemon.go:41) when godaemon's Context.Reborn() fails — colima could not fork/detach into the background daemon process. The %w carries the go-daemon error, which distinguishes fork failures from pid/log file problems.

Source

Thrown at cmd/daemon/daemon.go:41

// daemonize creates the daemon and returns if this is a child process
func daemonize() (ctx *godaemon.Context, child bool, err error) {
	dir := dir()
	if err := fsutil.MkdirAll(dir, 0755); err != nil {
		return nil, false, fmt.Errorf("cannot make dir: %w", err)
	}

	info := Info()

	ctx = &godaemon.Context{
		PidFileName: info.PidFile,
		PidFilePerm: 0644,
		LogFileName: info.LogFile,
		LogFilePerm: 0644,
	}

	d, err := ctx.Reborn()
	if err != nil {
		return ctx, false, fmt.Errorf("error starting daemon: %w", err)
	}
	if d != nil {
		return ctx, false, nil
	}

	logrus.Info("- - - - - - - - - - - - - - -")
	logrus.Info("daemon started by colima")
	logrus.Infof("Run `/usr/bin/pkill -F %s` to kill the daemon", info.PidFile)

	return ctx, true, nil
}

func start(ctx context.Context, processes []process.Process) error {
	if status() == nil {
		logrus.Info("daemon already running, startup ignored")
		return nil
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Read the wrapped error (%w) — a fork error points to sandbox/limits, a file error points to pid/log paths
  2. Clear stale artifacts when no daemon is running: remove daemon.pid and daemon.log from the daemon directory
  3. Fix ownership of the daemon directory: `sudo chown -R $(id -un) ~/.colima`
  4. In sandboxed environments, avoid triggering the daemon (skip features that require it) or raise process/resource limits
Defensive patterns

Strategy: retry

Try / catch

if err := daemonStart(); err != nil {
    if strings.Contains(err.Error(), "error starting daemon") {
        // fork or pid/log file failure: clear stale daemon.pid/daemon.log,
        // fix permissions, then retry once
        _ = os.Remove(pidFile)
        if err2 := daemonStart(); err2 != nil {
            return fmt.Errorf("daemon failed after cleanup: %w", err2)
        }
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: fork(2) blocked by sandboxing/seccomp or process limits (CI containers, restricted macOS contexts); daemon.pid or daemon.log under the daemon dir not writable or already locked; system out of processes; leftover unreadable pid file from a root-run daemon.

Common situations: Starting the daemon inside containers/CI without fork permission; stale daemon artifacts from a crashed previous run; disk full preventing log file creation.

Related errors


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