chenhg5/cc-connect · error

systemctl not found: systemd is required on Linux; if runnin

Error message

systemctl not found: systemd is required on Linux; if running in a container without systemd, use nohup, tmux, or screen instead

What it means

On Linux, the daemon manager is systemd (newPlatformManager). Before creating the manager it checks that the `systemctl` binary exists via exec.LookPath; this error is returned when systemctl is not on PATH, meaning systemd-based service management cannot work.

Source

Thrown at daemon/systemd.go:26

	"os"
	"os/exec"
	"path/filepath"
	"sort"
	"strconv"
	"strings"
)

const (
	systemdServiceName = ServiceName + ".service"
)

type systemdManager struct {
	system bool // true = system-level (/etc/systemd/system), false = user-level (~/.config/systemd/user)
}

func newPlatformManager() (Manager, error) {
	if _, err := exec.LookPath("systemctl"); err != nil {
		return nil, fmt.Errorf("systemctl not found: systemd is required on Linux; if running in a container without systemd, use nohup, tmux, or screen instead")
	}

	isRoot := os.Getuid() == 0

	if isRoot {
		if err := checkSystemdRunning(true); err != nil {
			return nil, err
		}
		return &systemdManager{system: true}, nil
	}

	if err := checkSystemdRunning(false); err != nil {
		return nil, err
	}
	return &systemdManager{system: false}, nil
}

func (m *systemdManager) Platform() string {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Run the daemon with nohup instead: `nohup cc-connect serve &`, as the error message suggests.
  2. Use tmux or screen to keep the process alive: `tmux new -d 'cc-connect serve'`.
  3. If in Docker, enable systemd in the container (e.g. systemd-enabled images or --privileged with /sbin/init) or install/enable systemd if using WSL2 (systemd=true in /etc/wsl.conf).
  4. Install systemd/sysvinit tooling if the host should have it but PATH is stripped.

Example fix

// before (container without systemd)
$ cc-connect daemon install   # systemctl not found
// after
$ nohup cc-connect serve > ~/cc-connect.log 2>&1 &
Defensive patterns

Strategy: fallback

Validate before calling

if runtime.GOOS == "linux" {
    if _, err := exec.LookPath("systemctl"); err != nil {
        // environment has no systemd; choose nohup/tmux/screen path instead
    }
}

Try / catch

_, err := daemon.NewManager() // via install path
if err != nil {
    if strings.Contains(err.Error(), "systemctl not found") {
        // fall back to manual process management
        exec.Command("sh", "-c", "nohup cc-connect serve &").Start()
        return nil
    }
    return err
}

Prevention

When it happens

Trigger: Running `cc-connect daemon install` (Linux path) inside a container or environment without systemd — no systemctl binary on PATH (e.g. plain Docker images, WSL1, chroots).

Common situations: Docker containers without systemd; minimal Alpine/scratch-based images; WSL without systemd enabled; older init systems (upstart, runit); CI runners.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/03fa3e58fa6ba7ab. Report an issue: GitHub.