kubernetes/kops · error
error doing systemd %s %s: %v Output: %s
Error message
error doing systemd %s %s: %v Output: %s
What it means
RenderLocal applies the chosen systemd action (start/stop/restart, run with --no-block) via exec and includes the command's combined output in the error when systemctl exits non-zero. This means systemd itself failed to schedule/perform the action on the service.
Source
Thrown at upup/pkg/fi/nodeup/nodetasks/service.go:401
klog.V(2).Infof("will restart service %q because dependency changed after service start", serviceName)
action = "restart"
} else {
klog.V(2).Infof("will not restart service %q - started after dependencies", serviceName)
}
}
}
}
}
if action != "" && fi.ValueOf(e.ManageState) {
args := []string{"systemctl", action, serviceName}
// We use --no-block to avoid hanging if the service has issues stopping/starting
args = append(args, "--no-block")
cmd := exec.Command(args[0], args[1:]...)
klog.Infof("Restarting service %q (running %q)", serviceName, strings.Join(cmd.Args, " "))
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("error doing systemd %s %s: %v\nOutput: %s", action, serviceName, err, output)
}
}
if changes.Enabled != nil && fi.ValueOf(e.ManageState) {
var args []string
if fi.ValueOf(e.Enabled) {
klog.Infof("Enabling service %q", serviceName)
args = []string{"enable", serviceName}
} else {
klog.Infof("Disabling service %q", serviceName)
args = []string{"disable", serviceName}
}
cmd := exec.Command("systemctl", args...)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("error doing 'systemctl %v': %v\nOutput: %s", args, err, output)
}View on GitHub (pinned to 4c8573c808)
Solutions
- Read the Output section of the error — it contains systemctl's own message; fix the unit or binary it names
- Run `systemd-analyze verify /etc/systemd/system/<svc>` to validate the unit
- Check the unit isn't masked: systemctl status <svc>; unmask if needed
- Run the restart manually: systemctl restart <svc> to reproduce and see full logs (journalctl -u <svc>)
Example fix
// before: unit with bad path ExecStart=/usr/local/bin/protokube # binary not present // after: ensure binary installed or fix path ExecStart=/opt/kops/bin/protokube
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate before applying: systemd-analyze verify /etc/systemd/system/<unit> systemctl cat <unit> >/dev/null && echo 'unit loadable'
Try / catch
if err := task.RenderLocal(...); err != nil {
if strings.Contains(err.Error(), "error doing systemd") {
// error embeds action, service, and systemctl Output
return fmt.Errorf("systemctl action failed; fix unit/binary per Output: %w", err)
}
return err
} Prevention
- Ensure ExecStart binaries exist before the service task runs
- Keep generated unit files valid (systemd-analyze verify)
- Avoid masking units nodeup manages
- Confirm systemd availability before nodeup
When it happens
Trigger: exec of `systemctl restart --no-block <svc>` (or start/stop) returns non-zero: unit file invalid after write, service binary missing, unit masked, or systemd rejecting the request (dbus down, not booted with systemd).
Common situations: A hand-edited or generated unit with bad ExecStart path, a masked unit, running nodeup on a system without systemd, or dependency ordering failures reported by systemd.
Related errors
- error doing systemd daemon-reload: %v Output: %s
- error doing 'systemctl %v': %v Output: %s
- error building kubelet flags: %v
- failed to create bpf mount unit: %w
- failed to create cgroupv2 mount unit: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/e2d92b8fce1e336f.
Report an issue: GitHub.