kubernetes/kops · error
error doing mount %q: %v: %s
Error message
error doing mount %q: %v: %s
What it means
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.
Source
Thrown at upup/pkg/fi/nodeup/nodetasks/bindmount.go:225
return fmt.Errorf("unknown option: %q", option)
}
}
{
args := []string{"mount"}
if e.Recursive {
args = append(args, "--rbind")
} else {
args = append(args, "--bind")
}
if len(simpleOptions) != 0 {
args = append(args, "-o", strings.Join(simpleOptions, ","))
}
args = append(args, e.Source, e.Mountpoint)
klog.Infof("running mount command %s", args)
if output, err := t.CombinedOutput(args); err != nil {
return fmt.Errorf("error doing mount %q: %v: %s", strings.Join(args, " "), err, string(output))
}
}
if len(remountOptions) != 0 {
args := []string{"mount", "-o", "remount," + strings.Join(remountOptions, ","), e.Mountpoint}
klog.Infof("running mount command %s", args)
if output, err := t.CombinedOutput(args); err != nil {
return fmt.Errorf("error doing mount options %q: %v: %s", strings.Join(args, " "), err, string(output))
}
}
if len(makeOptions) != 0 {
args := []string{"mount"}
args = append(args, makeOptions...)
args = append(args, e.Mountpoint)
klog.Infof("running mount command %s", args)View on GitHub (pinned to 4c8573c808)
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
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := os.Stat(source); err != nil { return fmt.Errorf("bindmount source missing: %w", err) }
if _, err := os.Stat(mountpoint); err != nil {
if err := os.MkdirAll(mountpoint, 0o755); err != nil { return err }
}
if mounted, _ := isMounted(mountpoint); mounted { return errors.New("already mounted") } Try / catch
out, err := t.CombinedOutput(args)
if err != nil {
return fmt.Errorf("error doing mount %q: %v: %s", strings.Join(args, " "), err, string(out))
}
// inspect output for errno: EBUSY -> already mounted, ENOENT -> create paths, EPERM -> privileges Prevention
- 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
When it happens
Trigger: 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).
Common situations: Missing mountpoint directory; source device/directory not yet provisioned; EBUSY on double mount; running nodeup without root in a container.
Related errors
- error doing mount options %q: %v: %s
- failed to create bpf mount unit: %w
- failed to create cgroupv2 mount unit: %w
- failed to ensure the directory: %s, error: %w
- failed to check if device %q is mounted, error: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/e2ff6685218c239a.
Report an issue: GitHub.