{"record":{"id":"1a42ed0d77755842","repo":"kubernetes/kops","slug":"error-doing-systemd-show-s-v-output-s","errorCode":null,"errorMessage":"error doing systemd show %s: %v\nOutput: %s","messagePattern":"error doing systemd show (.+?): (.+?)\nOutput: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/nodetasks/service.go","lineNumber":149,"sourceCode":"\t}\n\tif s.ManageState == nil {\n\t\ts.ManageState = new(true)\n\t}\n\n\t// Default Enabled to be the same as running\n\tif s.Enabled == nil {\n\t\ts.Enabled = s.Running\n\t}\n\n\treturn s\n}\n\nfunc getSystemdStatus(name string) (map[string]string, error) {\n\tklog.V(2).Infof(\"querying state of service %q\", name)\n\tcmd := exec.Command(\"systemctl\", \"show\", \"--all\", name)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error doing systemd show %s: %v\\nOutput: %s\", name, err, output)\n\t}\n\tproperties := make(map[string]string)\n\tfor _, line := range strings.Split(string(output), \"\\n\") {\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ttokens := strings.SplitN(line, \"=\", 2)\n\t\tif len(tokens) != 2 {\n\t\t\tklog.Warningf(\"Ignoring line in systemd show output: %q\", line)\n\t\t\tcontinue\n\t\t}\n\t\tproperties[tokens[0]] = tokens[1]\n\t}\n\treturn properties, nil\n}\n\nfunc (_ *Service) systemdSystemPath() (string, error) {\n\td, err := distributions.FindDistribution(\"/\")","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/nodetasks/service.go#L131-L167","documentation":"getSystemdStatus runs `systemctl show --all <name>` to read unit properties; any non-zero exit of systemctl is wrapped in this error. It means nodeup could not query systemd's view of the service, so Find/RenderLocal cannot determine the service state.","triggerScenarios":"systemctl exits non-zero: the unit name is invalid, systemd is not running as PID 1 (containers/chroot), dbus is broken, or systemctl binary is missing.","commonSituations":"Running nodeup inside a container without systemd; unit files with invalid names/escaping; systemd/dbus in a failed state after an upgrade; minimal images without full systemd.","solutions":["Check the embedded Output in the error for systemctl's own message.","Confirm the host actually runs systemd: `ps -p 1 -o comm=` should print systemd.","Verify the service unit name is correct and valid (`systemd-escape` if needed).","Check dbus: systemctl failed with 'Failed to connect to bus' typically indicates dbus/systemd must be restarted."],"exampleFix":"// before (container with no systemd)\n$ nodeup  # error doing systemd show kubelet.service\n// after: run nodeup on a systemd host, or verify unit\n$ systemctl cat kubelet.service","handlingStrategy":"validation","validationCode":"if init, _ := ioutil.ReadFile(\"/proc/1/comm\"); strings.TrimSpace(string(init)) != \"systemd\" {\n    return errors.New(\"systemd not running as PID 1; getSystemdStatus will fail\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := getSystemdStatus(name); err != nil {\n    if strings.Contains(err.Error(), \"Failed to connect to bus\") {\n        // restart dbus/systemd or fail bootstrap with clear message\n    }\n}","preventionTips":["Only run nodeup on hosts booted with systemd","Validate unit names with systemd-escape","Check dbus health after systemd upgrades before bootstrap"],"tags":["systemd","service","nodeup"],"backgroundTag":"systemd-show-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"}