kubernetes/kops · error
error doing 'systemctl %v': %v Output: %s
Error message
error doing 'systemctl %v': %v Output: %s
What it means
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.
Source
Thrown at upup/pkg/fi/nodeup/nodetasks/service.go:418
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)
}
}
return nil
}
func (s *Service) GetName() *string {
return &s.Name
}
View on GitHub (pinned to 4c8573c808)
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
Example fix
// before: unit without [Install] [Service] ExecStart=/usr/bin/foo // after [Service] ExecStart=/usr/bin/foo [Install] WantedBy=multi-user.target
Defensive patterns
Strategy: validation
Validate before calling
// Ensure the unit is enableable before nodeup: grep -q '^\[Install\]' /etc/systemd/system/<unit> && \ grep -q '^WantedBy=' /etc/systemd/system/<unit> && echo enableable || echo 'missing [Install]/WantedBy'
Try / catch
if err := task.RenderLocal(...); err != nil {
if strings.Contains(err.Error(), "systemctl enable") || strings.Contains(err.Error(), "systemctl disable") {
return fmt.Errorf("enablement failed; add [Install] section: %w", err)
}
return err
} Prevention
- Always include [Install] WantedBy=multi-user.target in generated units
- Verify WantedBy targets exist on the image
- Run nodeup only on booted systemd hosts
When it happens
Trigger: 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.
Common situations: Generated unit definitions missing WantedBy=[Install] sections, custom minimal images lacking standard targets, or nodeup run outside a booted systemd host.
Related errors
- error doing systemd daemon-reload: %v Output: %s
- error doing systemd %s %s: %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/20e3850c10a47c6d.
Report an issue: GitHub.