kubernetes/kops · error

error doing systemd daemon-reload: %v Output: %s

Error message

error doing systemd daemon-reload: %v
Output: %s

What it means

After writing a changed unit definition, RenderLocal runs `systemctl daemon-reload` so systemd picks up the new file. Any non-zero exit from systemctl (with its combined stdout/stderr attached) becomes this error, meaning the node's systemd refused or could not perform the reload.

Source

Thrown at upup/pkg/fi/nodeup/nodetasks/service.go:335

		if fi.ValueOf(e.Running) {
			action = "restart"
		} else {
			action = "stop"
		}
	}

	if changes.Definition != nil {
		servicePath := path.Join(systemdSystemPath, serviceName)
		err := fi.WriteFile(servicePath, fi.NewStringResource(*e.Definition), 0o644, 0o755, "", "")
		if err != nil {
			return fmt.Errorf("error writing systemd service file: %v", err)
		}

		klog.Infof("Reloading systemd configuration")
		cmd := exec.Command("systemctl", "daemon-reload")
		output, err := cmd.CombinedOutput()
		if err != nil {
			return fmt.Errorf("error doing systemd daemon-reload: %v\nOutput: %s", err, output)
		}
	}

	// "SmartRestart" - look at the obvious dependencies in the systemd service, restart if start time older
	if fi.ValueOf(e.ManageState) && fi.ValueOf(e.SmartRestart) {
		definition := fi.ValueOf(e.Definition)
		if definition == "" && a != nil {
			definition = fi.ValueOf(a.Definition)
		}

		if action == "" && fi.ValueOf(e.Running) && definition != "" {
			dependencies, err := getSystemdDependencies(serviceName, definition)
			if err != nil {
				return err
			}

			// Include the systemd unit file itself
			dependencies = append(dependencies, path.Join(systemdSystemPath, serviceName))

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Confirm systemd is PID 1 on the node (nodeup must run on a real host, not a container): ps -p 1
  2. Run `systemctl daemon-reload` manually to see the underlying unit validation error and fix the offending unit
  3. Verify /bin/systemctl exists and works on the image
  4. Check dbus: systemctl failed with 'Failed to connect to bus' usually means systemd/dbus is down; reboot the node

Example fix

// diagnostic
$ systemctl daemon-reload
Failed to start ... /etc/systemd/system/broken.service:9
// after: fix broken.service syntax, then re-run nodeup
Defensive patterns

Strategy: retry

Validate before calling

// Verify systemd is operational before nodeup:
sudo systemctl is-system-running || echo 'systemd degraded/not running'
ps -p 1 -o comm=   # must be systemd

Try / catch

if err := task.RenderLocal(...); err != nil {
	if strings.Contains(err.Error(), "daemon-reload") {
		// log attached Output, fix offending unit, retry after recovery
		return fmt.Errorf("systemd reload failed; inspect node systemd/dbus: %w", err)
	}
	return err
}
// Prefer bounded retry once systemd is healthy again

Prevention

When it happens

Trigger: exec.Command("systemctl", "daemon-reload").CombinedOutput() returns err — systemctl binary missing, systemd not running as PID 1 (e.g. in a container), dbus not reachable, or a broken unit file elsewhere causing reload validation failure.

Common situations: Running nodeup inside a container/CI without systemd, a hosed dbus/systemd after partial upgrades, or another malformed unit on the node making daemon-reload fail.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/1da68ec13206df97. Report an issue: GitHub.