{"record":{"id":"20e3850c10a47c6d","repo":"kubernetes/kops","slug":"error-doing-systemctl-v-v-output-s","errorCode":null,"errorMessage":"error doing 'systemctl %v': %v\nOutput: %s","messagePattern":"error doing 'systemctl (.+?)': (.+?)\nOutput: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/nodetasks/service.go","lineNumber":418,"sourceCode":"\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}\n\t}\n\n\treturn nil\n}\n\nfunc (s *Service) GetName() *string {\n\treturn &s.Name\n}\n","sourceCodeStart":400,"sourceCodeEnd":428,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/nodetasks/service.go#L400-L428","documentation":"When Enabled changes and ManageState is set, RenderLocal runs `systemctl enable|disable <svc>` and wraps any failure — with systemctl's combined output — in this error. It means the enablement change (creating/removing the [Install] symlink) could not be completed.","triggerScenarios":"exec of `systemctl enable/disable <svc>` fails: unit has no [Install] section so enable is impossible, target (e.g. multi-user.target) missing, or systemd/dbus unavailable.","commonSituations":"Generated unit definitions missing WantedBy=[Install] sections, custom minimal images lacking standard targets, or nodeup run outside a booted systemd host.","solutions":["Check Output in the error message; 'no installation config' means the unit lacks an [Install] section — add WantedBy=multi-user.target to the unit definition","Verify the WantedBy target exists: ls /etc/systemd/system/multi-user.target.wants or systemctl list-unit-files | grep multi-user.target","Run `systemctl enable <svc>` manually to reproduce the failure","Confirm systemd is running (ps -p 1) if failures look like bus-connect errors"],"exampleFix":"// before: unit without [Install]\n[Service]\nExecStart=/usr/bin/foo\n// after\n[Service]\nExecStart=/usr/bin/foo\n[Install]\nWantedBy=multi-user.target","handlingStrategy":"validation","validationCode":"// Ensure the unit is enableable before nodeup:\ngrep -q '^\\[Install\\]' /etc/systemd/system/<unit> && \\\n  grep -q '^WantedBy=' /etc/systemd/system/<unit> && echo enableable || echo 'missing [Install]/WantedBy'","typeGuard":null,"tryCatchPattern":"if err := task.RenderLocal(...); err != nil {\n\tif strings.Contains(err.Error(), \"systemctl enable\") || strings.Contains(err.Error(), \"systemctl disable\") {\n\t\treturn fmt.Errorf(\"enablement failed; add [Install] section: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Always include [Install] WantedBy=multi-user.target in generated units","Verify WantedBy targets exist on the image","Run nodeup only on booted systemd hosts"],"tags":["nodeup","systemd","enable","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"}