- msg("Binding %s on %s\n", out, in);
- if (mount(out, root_in, "none", MS_BIND | MS_NOSUID | MS_NODEV | mount_flags, "") < 0)
- die("Cannot bind %s on %s: %m", out, in);
+ mount_flags |= MS_BIND | MS_NOSUID;
+ msg("Binding %s on %s (flags %lx)\n", out, in, mount_flags);
+ // Most mount flags need remount to work
+ if (mount(out, root_in, "none", mount_flags, "") < 0 ||
+ mount(out, root_in, "none", MS_REMOUNT | mount_flags, "") < 0)
+ die("Cannot mount %s on %s: %m", out, in);