{"record":{"id":"edf588d435b0220a","repo":"kubernetes/kops","slug":"package-repair-not-supported-on-rhel-centos","errorCode":null,"errorMessage":"package repair not supported on RHEL/CentOS","messagePattern":"package repair not supported on RHEL/CentOS","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/nodetasks/package.go","lineNumber":401,"sourceCode":"\t\t\treturn fmt.Errorf(\"error installing package %q: %v: %s\", e.Name, err, string(output))\n\t\t}\n\t\t// Successful package install, updating the last updated time.\n\t\tpackageManagerLastUpdated = time.Now()\n\t} else {\n\t\tif changes.Healthy != nil {\n\t\t\tif d.IsDebianFamily() {\n\t\t\t\targs := []string{\"dpkg\", \"--configure\", \"-a\"}\n\t\t\t\tklog.Infof(\"package is not healthy; running command %s\", args)\n\t\t\t\tcmd := exec.Command(args[0], args[1:]...)\n\t\t\t\toutput, err := cmd.CombinedOutput()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error running `dpkg --configure -a`: %v: %s\", err, string(output))\n\t\t\t\t}\n\n\t\t\t\tchanges.Healthy = nil\n\t\t\t} else if d.IsRHELFamily() {\n\t\t\t\t// Not set on TagOSFamilyRHEL, we can't currently reach here anyway...\n\t\t\t\treturn fmt.Errorf(\"package repair not supported on RHEL/CentOS\")\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"unsupported package system\")\n\t\t\t}\n\t\t}\n\n\t\tif !reflect.DeepEqual(changes, &Package{}) {\n\t\t\tklog.Warningf(\"cannot apply package changes for %q: %+v\", e.Name, changes)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":383,"sourceCodeEnd":414,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/nodetasks/package.go#L383-L414","documentation":"RenderLocal in the nodeup Package task attempts to repair a broken dpkg state by running `dpkg --configure -a` on Debian-family hosts. When the host is RHEL/CentOS-family, no equivalent repair path is implemented, so the task returns this error instead of proceeding with undefined behavior. It is an explicit guard against an unsupported OS family.","triggerScenarios":"A Package task's changes require repair (Healthy was set and repair path entered) while nodeup runs on an RHEL-family host where the package manager is not TagOSFamilyRHEL-tagged with a repair implementation.","commonSituations":"Running nodeup on an AMI built from RHEL/CentOS/Rocky/Alma and having a package task drift into an unhealthy/repair state; mixing Debian-based and RHEL-based machine images in the same cluster.","solutions":["Use a Debian-family (Ubuntu/Debian) AMI when your cluster config defines Package tasks that may need repair.","Ensure the Package task reaches a healthy state on RHEL so the repair branch is never entered (pre-install packages via the image, or fix yum repo issues).","If RHEL support is needed, add a repair path (e.g. `rpm --rebuilddb` / dnf equivalents) gated on TagOSFamilyRHEL in package.go."],"exampleFix":"// before (cluster.yaml)\nkubernetesVersion: v1.28.3\nmachineType: m5.large  # RHEL AMI\n// after: provision from Ubuntu image or avoid Package repair on RHEL\nami: ami-0ubuntu...","handlingStrategy":"validation","validationCode":"if isRHELFamily() && taskRequiresPackageRepair() {\n    return errors.New(\"precondition failed: package repair unsupported on RHEL/CentOS\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use Debian-family images when relying on kOps-managed Package tasks","Ensure packages are pre-baked into RHEL AMIs so the repair path never triggers","Keep package repos healthy on RHEL nodes so Healthy state is reached"],"tags":["nodeup","package-manager","rhel","os-family"],"backgroundTag":"unsupported-os-family","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"}