{"record":{"id":"1cf6156a11a57fe2","repo":"kubernetes/kubernetes","slug":"chroot-is-not-implemented-on-windows","errorCode":null,"errorMessage":"chroot is not implemented on Windows","messagePattern":"chroot is not implemented on Windows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kubeadm/app/util/chroot_windows.go","lineNumber":29,"sourceCode":"\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\npackage util\n\nimport (\n\t\"k8s.io/kubernetes/cmd/kubeadm/app/util/errors\"\n)\n\n// Chroot chroot()s to the new path.\n// NB: All file paths after this call are effectively relative to\n// `rootfs`\nfunc Chroot(rootfs string) error {\n\treturn errors.New(\"chroot is not implemented on Windows\")\n}\n","sourceCodeStart":11,"sourceCodeEnd":31,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/cmd/kubeadm/app/util/chroot_windows.go#L11-L31","documentation":"Returned by Chroot() in the Windows-only build (chroot_windows.go, //go:build windows). The POSIX chroot(2) syscall does not exist on Windows, so kubeadm's Chroot helper is a stub that always errors. Code calling util.Chroot on Windows cannot perform a chroot.","triggerScenarios":"Any code path on a Windows build that invokes util.Chroot(rootfs). The function unconditionally returns this error.","commonSituations":"Running/porting kubeadm or a kubeadm-derived tool on Windows where a shared code path calls Chroot. kubeadm control-plane nodes are Linux-only, so this mainly affects experimentation/ports.","solutions":["Avoid the chroot code path on Windows; gate callers with a runtime.GOOS check.","Run the workflow on Linux where Chroot is implemented (chroot.go, the !windows build).","Refactor the caller to not require chroot semantics on Windows."],"exampleFix":"// before\nif err := util.Chroot(rootfs); err != nil { return err }\n\n// after\nif runtime.GOOS != \"windows\" {\n    if err := util.Chroot(rootfs); err != nil { return err }\n}","handlingStrategy":"validation","validationCode":"if runtime.GOOS == \"windows\" {\n    return errors.New(\"util.Chroot is not supported on Windows; restructure to avoid chroot\")\n}","typeGuard":"func chrootSupported() bool { return runtime.GOOS != \"windows\" }","tryCatchPattern":null,"preventionTips":["Gate any chroot-dependent code path behind runtime.GOOS checks.","Run control-plane provisioning on Linux where Chroot is implemented.","Avoid sharing chroot-using code with Windows builds."],"tags":["kubeadm","windows","chroot","platform"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}