kubernetes/kops · error

unknown option

Error message

unknown option: %q

What it means

BindMount.execute parses the mount Options list into categories (simple, remount, make-shared options). An option it does not recognize (not a mount flag like exec/noexec/suid/nosuid/dev/nodev, not ro/rw/shared etc.) causes this error. It is a programming/config validation error preventing the mount from being performed.

Solutions

  1. Remove or correct the unsupported option in the BindMount task's Options list
  2. Only use options known to the switch: ro/rw, shared/rshared/private/rprivate/slave/rslave, exec/noexec, suid/nosuid, dev/nodev, --make-rshared
  3. Update kOps to a version supporting the desired option, or extend bindmount.go's switch
  4. Check which option value triggered it — the %q in the error names the exact culprit

Example fix

// before
e.Options = []string{"rw", "relatime"}
// returns "unknown option: \"relatime\""
// after
e.Options = []string{"rw"} // only handled options
Defensive patterns

Strategy: validation

Validate before calling

var known = map[string]bool{
  "ro": true, "rw": true, "shared": true, "rshared": true, "private": true,
  "rprivate": true, "slave": true, "rslave": true, "exec": true, "noexec": true,
  "suid": true, "nosuid": true, "dev": true, "nodev": true,
}
for _, o := range opts {
  if !known[o] { return fmt.Errorf("unsupported bindmount option %q", o) }
}

Try / catch

if err := nodeup.Run(ctx); err != nil {
  if strings.Contains(err.Error(), "unknown option") {
    // message names the offending option via %q — fix the task config
  }
}

Prevention

When it happens

Trigger: A BindMount task is created with an option string outside the known switch cases — e.g. a typo like "recatime" instead of "relatime" or a kernel-specific flag the task does not handle.

Common situations: Custom model code or patched kOps adding new mount options; typo in instance-group/mount configuration; upstream adding kernel options not yet handled by bindmount.go.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/34c3add9f87fc541. Report an issue: GitHub.

Appendix: source

Thrown at upup/pkg/fi/nodeup/nodetasks/bindmount.go:207

}

func (e *BindMount) execute(t Executor) error {
	var simpleOptions []string
	var makeOptions []string
	var remountOptions []string
	for _, option := range e.Options {
		switch option {
		case "ro":
			simpleOptions = append(simpleOptions, option)

		case "rshared":
			makeOptions = append(makeOptions, "--make-rshared")

		case "exec", "noexec", "suid", "nosuid", "dev", "nodev":
			remountOptions = append(remountOptions, option)

		default:
			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))

View on GitHub (pinned to 4c8573c808)