{"record":{"id":"e2d92b8fce1e336f","repo":"kubernetes/kops","slug":"error-doing-systemd-s-s-v-output-s","errorCode":null,"errorMessage":"error doing systemd %s %s: %v\nOutput: %s","messagePattern":"error doing systemd (.+?) (.+?): (.+?)\nOutput: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/nodetasks/service.go","lineNumber":401,"sourceCode":"\t\t\t\t\t\tklog.V(2).Infof(\"will restart service %q because dependency changed after service start\", serviceName)\n\t\t\t\t\t\taction = \"restart\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\tklog.V(2).Infof(\"will not restart service %q - started after dependencies\", serviceName)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif action != \"\" && fi.ValueOf(e.ManageState) {\n\t\targs := []string{\"systemctl\", action, serviceName}\n\t\t// We use --no-block to avoid hanging if the service has issues stopping/starting\n\t\targs = append(args, \"--no-block\")\n\t\tcmd := exec.Command(args[0], args[1:]...)\n\t\tklog.Infof(\"Restarting service %q (running %q)\", serviceName, strings.Join(cmd.Args, \" \"))\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error doing systemd %s %s: %v\\nOutput: %s\", action, serviceName, err, output)\n\t\t}\n\t}\n\n\tif changes.Enabled != nil && fi.ValueOf(e.ManageState) {\n\t\tvar args []string\n\t\tif fi.ValueOf(e.Enabled) {\n\t\t\tklog.Infof(\"Enabling service %q\", serviceName)\n\t\t\targs = []string{\"enable\", serviceName}\n\t\t} else {\n\t\t\tklog.Infof(\"Disabling service %q\", serviceName)\n\t\t\targs = []string{\"disable\", serviceName}\n\t\t}\n\t\tcmd := exec.Command(\"systemctl\", args...)\n\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error doing 'systemctl %v': %v\\nOutput: %s\", args, err, output)\n\t\t}","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/nodetasks/service.go#L383-L419","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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>)"],"exampleFix":"// before: unit with bad path\nExecStart=/usr/local/bin/protokube   # binary not present\n// after: ensure binary installed or fix path\nExecStart=/opt/kops/bin/protokube","handlingStrategy":"try-catch","validationCode":"// Validate before applying:\nsystemd-analyze verify /etc/systemd/system/<unit>\nsystemctl cat <unit> >/dev/null && echo 'unit loadable'","typeGuard":null,"tryCatchPattern":"if err := task.RenderLocal(...); err != nil {\n\tif strings.Contains(err.Error(), \"error doing systemd\") {\n\t\t// error embeds action, service, and systemctl Output\n\t\treturn fmt.Errorf(\"systemctl action failed; fix unit/binary per Output: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["nodeup","systemd","service-restart","exec"],"backgroundTag":"systemctl-command-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}