{"record":{"id":"e2ff6685218c239a","repo":"kubernetes/kops","slug":"error-doing-mount-q-v-s","errorCode":null,"errorMessage":"error doing mount %q: %v: %s","messagePattern":"error doing mount %q: (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/nodetasks/bindmount.go","lineNumber":225,"sourceCode":"\t\t\treturn fmt.Errorf(\"unknown option: %q\", option)\n\t\t}\n\t}\n\n\t{\n\t\targs := []string{\"mount\"}\n\t\tif e.Recursive {\n\t\t\targs = append(args, \"--rbind\")\n\t\t} else {\n\t\t\targs = append(args, \"--bind\")\n\t\t}\n\t\tif len(simpleOptions) != 0 {\n\t\t\targs = append(args, \"-o\", strings.Join(simpleOptions, \",\"))\n\t\t}\n\t\targs = append(args, e.Source, e.Mountpoint)\n\n\t\tklog.Infof(\"running mount command %s\", args)\n\t\tif output, err := t.CombinedOutput(args); err != nil {\n\t\t\treturn fmt.Errorf(\"error doing mount %q: %v: %s\", strings.Join(args, \" \"), err, string(output))\n\t\t}\n\t}\n\n\tif len(remountOptions) != 0 {\n\t\targs := []string{\"mount\", \"-o\", \"remount,\" + strings.Join(remountOptions, \",\"), e.Mountpoint}\n\n\t\tklog.Infof(\"running mount command %s\", args)\n\t\tif output, err := t.CombinedOutput(args); err != nil {\n\t\t\treturn fmt.Errorf(\"error doing mount options %q: %v: %s\", strings.Join(args, \" \"), err, string(output))\n\t\t}\n\t}\n\n\tif len(makeOptions) != 0 {\n\t\targs := []string{\"mount\"}\n\t\targs = append(args, makeOptions...)\n\t\targs = append(args, e.Mountpoint)\n\n\t\tklog.Infof(\"running mount command %s\", args)","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/nodetasks/bindmount.go#L207-L243","documentation":"After option classification, execute runs the `mount <source> <mountpoint>` command (with -o for simple options). If the mount binary fails, the full argument list, error, and combined output are wrapped with this message. It means the kernel/sys mount of the source to the mountpoint failed.","triggerScenarios":"t.CombinedOutput on `mount` returns non-zero — source path doesn't exist, mountpoint missing, already mounted, unsupported filesystem, or insufficient privileges (not root / missing CAP_SYS_ADMIN).","commonSituations":"Missing mountpoint directory; source device/directory not yet provisioned; EBUSY on double mount; running nodeup without root in a container.","solutions":["Read the wrapped mount output for the kernel's errno (e.g. \"No such file or directory\", \"already mounted\") and fix accordingly","Ensure the mountpoint directory exists and the source path/device is present before nodeup runs","Verify nodeup runs as root with CAP_SYS_ADMIN (host systemd unit, privileged container)","Check `mount | grep <mountpoint>` for an existing conflicting mount"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(source); err != nil { return fmt.Errorf(\"bindmount source missing: %w\", err) }\nif _, err := os.Stat(mountpoint); err != nil {\n  if err := os.MkdirAll(mountpoint, 0o755); err != nil { return err }\n}\nif mounted, _ := isMounted(mountpoint); mounted { return errors.New(\"already mounted\") }","typeGuard":null,"tryCatchPattern":"out, err := t.CombinedOutput(args)\nif err != nil {\n  return fmt.Errorf(\"error doing mount %q: %v: %s\", strings.Join(args, \" \"), err, string(out))\n}\n// inspect output for errno: EBUSY -> already mounted, ENOENT -> create paths, EPERM -> privileges","preventionTips":["Pre-create mountpoint directories in the node image or earlier tasks","Ensure nodeup runs as root with CAP_SYS_ADMIN","Check existing mounts before re-running bootstrap","Validate the source path exists before the mount task renders"],"tags":["mount","linux","nodeup"],"backgroundTag":"mount-command-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"}