{"record":{"id":"57006d2ffec0237d","repo":"kubernetes/kops","slug":"error-checking-for-run-cilium-cgroupv2-v","errorCode":null,"errorMessage":"error checking for /run/cilium/cgroupv2: %v","messagePattern":"error checking for /run/cilium/cgroupv2: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodeup/pkg/model/networking/cilium.go","lineNumber":124,"sourceCode":"\t\t\tName:       \"sys-fs-bpf.mount\",\n\t\t\tDefinition: new(unit),\n\t\t}\n\t\tservice.InitDefaults()\n\t\tc.AddTask(service)\n\t}\n\n\treturn nil\n}\n\nfunc (b *CiliumBuilder) buildCgroup2Mount(c *fi.NodeupModelBuilderContext) error {\n\tcgroupPath := \"/run/cilium/cgroupv2\"\n\n\tvar fsdata unix.Statfs_t\n\terr := unix.Statfs(cgroupPath, &fsdata)\n\n\t// If the path does not exist, systemd will create it\n\tif err != nil && !errors.Is(err, os.ErrNotExist) {\n\t\treturn fmt.Errorf(\"error checking for /run/cilium/cgroupv2: %v\", err)\n\t}\n\n\tCGROUP_FS_MAGIC := uint32(0x63677270)\n\n\talreadyMounted := uint32(fsdata.Type) == CGROUP_FS_MAGIC\n\n\tif !alreadyMounted {\n\t\tunit := `\n[Unit]\nDescription=Cilium Cgroup2 mounts\nDocumentation=http://docs.cilium.io/\nDefaultDependencies=no\nBefore=local-fs.target umount.target kubelet.service\n\n[Mount]\nWhat=cgroup2\nWhere=/run/cilium/cgroupv2\nType=cgroup2","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/nodeup/pkg/model/networking/cilium.go#L106-L142","documentation":"buildCgroup2Mount calls unix.Statfs on /run/cilium/cgroupv2; if the error is anything other than os.ErrNotExist (which is tolerated because systemd creates the path), the error is wrapped and the build fails. This guards against unexpected filesystem errors on the cgroup path.","triggerScenarios":"unix.Statfs(cgroupPath) fails with e.g. EACCES, ENOTDIR, ELOOP, or an I/O error — anything besides ENOENT — during nodeup Build with Cilium enabled.","commonSituations":"/run not mounted or read-only; a non-directory file occupying /run/cilium/cgroupv2; permission/hardening policies blocking stat on /run paths; symlink loops from earlier failed runs.","solutions":["Check permissions and type of /run/cilium/cgroupv2 (remove a stray non-directory file: rm and let systemd recreate it)","Ensure /run is a writable tmpfs mount when nodeup runs","Read the wrapped errno in the message and fix the underlying filesystem condition","Reboot/clean stale state in /run/cilium and re-run nodeup"],"exampleFix":"// before\n$ ls -ld /run/cilium/cgroupv2\n-rw-r--r-- 1 root root 0 ...   # stray file, not a directory\n// after\n$ rm /run/cilium/cgroupv2   # systemd will create the cgroup dir","handlingStrategy":"type-guard","validationCode":"var fsdata unix.Statfs_t\nerr := unix.Statfs(\"/run/cilium/cgroupv2\", &fsdata)\nif err != nil && !errors.Is(err, os.ErrNotExist) {\n    // inspect errno\n    klog.Errorf(\"unexpected cgroupv2 stat error: %v\", err)\n}\nif fi, statErr := os.Stat(\"/run/cilium/cgroupv2\"); statErr == nil && !fi.IsDir() {\n    klog.Warning(\"/run/cilium/cgroupv2 is not a directory; remove it\")\n}","typeGuard":null,"tryCatchPattern":"err := unix.Statfs(cgroupPath, &fsdata)\nif err != nil && !errors.Is(err, os.ErrNotExist) {\n    return fmt.Errorf(\"error checking for /run/cilium/cgroupv2: %v\", err)\n}","preventionTips":["Check /run/cilium state after failed prior runs","Ensure /run is a writable tmpfs on all node images","Use errors.Is(err, os.ErrNotExist) semantics when tolerating missing paths"],"tags":["nodeup","cilium","cgroupv2","statfs","filesystem"],"backgroundTag":"cgroupv2-mount-unit-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}