kubernetes/kops · error

error doing mount options %q: %v: %s

Error message

error doing mount options %q: %v: %s

What it means

After the initial mount succeeds, execute runs a second `mount -o remount,<options> <mountpoint>` for options requiring remount (exec/noexec/suid/nosuid/dev/nodev). If the remount fails, the args, error and output are wrapped with this message. The initial mount succeeded but its restrictive/fluid options could not be applied.

Source

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

			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)
		if output, err := t.CombinedOutput(args); err != nil {
			return fmt.Errorf("error doing mount operation %q: %v: %s", strings.Join(args, " "), err, string(output))
		}
	}

	return nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped output for the specific kernel rejection and drop incompatible options from BindMount.Options
  2. Verify the filesystem type supports the remount options (check `man mount` per-filesystem notes)
  3. Ensure nodeup retains root/CAP_SYS_ADMIN through both mount phases
  4. Check for concurrent processes (kubelet, other nodeup runs) racing on the same mountpoint
Defensive patterns

Strategy: try-catch

Validate before calling

// verify the filesystem supports the remount options
fstype := detectFsType(mountpoint)
unsupported := incompatibleRemountOptions(fstype, remountOptions) // e.g. nosuid on some fs
if len(unsupported) > 0 { return fmt.Errorf("options %v unsupported on %s", unsupported, fstype) }

Try / catch

out, err := t.CombinedOutput(args)
if err != nil {
  return fmt.Errorf("error doing mount options %q: %v: %s", strings.Join(args, " "), err, string(out))
}
// treat kernel rejection output as the source of truth for which option to drop

Prevention

When it happens

Trigger: `mount -o remount,...` returns non-zero — remounting a read-only filesystem with new options, mountpoint vanished, or kernel rejecting the option combination (e.g. nodev on certain fuse/network filesystems).

Common situations: Remount options unsupported by the underlying filesystem (e.g. noexec/nosuid on tmpfs variants); racing with another process unmounting the target; container without privileges to remount.

Related errors


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