abiosoft/colima · error

error reloading systemd daemon: %w

Error message

error reloading systemd daemon: %w

What it means

Colima runs 'systemctl daemon-reload' inside the guest VM after installing the docker.service drop-in, and the systemctl call returned an error. It means systemd in the guest did not accept the reload — typically because systemd is not PID 1, the D-Bus/systemd socket is unavailable, or the just-written unit drop-in is syntactically invalid.

Source

Thrown at environment/container/docker/daemon.go:123

func (d dockerRuntime) addHostGateway(conf map[string]any) error {
	// get host-gateway ip from the guest
	ip, err := getHostGatewayIp(d, conf)
	if err != nil {
		return err
	}

	// set host-gateway ip as systemd service file
	content := fmt.Sprintf(systemdUnitFileContent, ip)
	if err := d.guest.Write(systemdUnitFilename, []byte(content)); err != nil {
		return fmt.Errorf("error creating systemd unit file: %w", err)
	}

	return nil
}

func (d dockerRuntime) reloadAndRestartSystemdService() error {
	if err := d.systemctl.DaemonReload(); err != nil {
		return fmt.Errorf("error reloading systemd daemon: %w", err)
	}
	if err := d.systemctl.Restart("docker.service"); err != nil {
		return fmt.Errorf("error restarting docker: %w", err)
	}
	return nil
}

const systemdUnitFilename = "/etc/systemd/system/docker.service.d/docker.conf"
const systemdUnitFileContent string = `
[Service]
LimitNOFILE=infinity
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --host-gateway-ip=%s
`

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Retry: 'colima stop && colima start'
  2. Manually verify in guest: 'colima ssh -- sudo systemctl daemon-reload' and read the error output
  3. Inspect the drop-in: 'colima ssh -- cat /etc/systemd/system/docker.service.d/docker.conf' for corruption
  4. Recreate the VM if the guest init/systemd setup is broken: 'colima delete && colima start'
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure systemd is functional in the guest before provisioning
if err := guest.Run("systemctl", "is-system-running"); err != nil {
    return fmt.Errorf("guest systemd not ready: %w", err)
}

Try / catch

if err := d.reloadAndRestartSystemdService(); err != nil {
    if strings.Contains(err.Error(), "error reloading systemd daemon") {
        // daemon-reload is often retryable once the guest settles
        time.Sleep(2 * time.Second)
        return d.reloadAndRestartSystemdService()
    }
    return err
}

Prevention

When it happens

Trigger: systemctl.DaemonReload() via the guest runner fails: systemd not running in the guest, guest SSH broken, malformed drop-in written in the previous step, or an image that uses a non-systemd init.

Common situations: Using a custom Lima image without systemd as init, guest VM in a half-booted state, drop-in file truncated by a full disk, or a docker version whose unit file semantics changed.

Related errors


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