Hello, I want to propose an idea to explain the flags passed to mount command found in the handbook. I am not saying we should add the entire explaination of those flags/command but at least we can give user a gist of what those command does and it they want to know more they can always read the man pages. these are the command which reader should be aware of what they do: ``` mount --types proc /proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --make-rslave /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev mount --make-rslave /mnt/gentoo/dev mount --bind /run /mnt/gentoo/run mount --make-slave /mnt/gentoo/run ``` wiki already explains what /proc, /sys, /dev, /run do however it doesn't explain what those flags do like --types, --rbind etc.
(picking this up from #gentoo-chat) Just to clarify: you're less after the *what*, and more of the *why* those particular mount flags are necessary for those filesystems in the context of an installation in progress, right? The existing paragraph explains that /proc is mounted ordinarily, and that the others are binds, but doesn't elaborate why binds are used, why /sys and /dev are rbinds while /run isn't. I have to admit, I don't know why this is either. I'm usually on autopilot until portage has been synced and I've never been curious enough to look into why this is. That's a shame. Hopefully the existing paragraph can be reworded in way that's not too verbose but does explain why /sys, /dev, and /run are mounted the way they are. If I could make one other suggestion, it would be to reorder the commands as: mount --types proc /proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev mount --bind /run /mnt/gentoo/run mount --make-rslave /mnt/gentoo/dev mount --make-rslave /mnt/gentoo/sys mount --make-slave /mnt/gentoo/run The number of times I've missed the /mnt/gentoo/run entries lacking the 'r' on bind and slave might have been avoided by grouping the bind and slave commands together.
(In reply to Ben Torkington from comment #1) > (picking this up from #gentoo-chat) > > Just to clarify: you're less after the *what*, and more of the *why* those > particular mount flags are necessary for those filesystems in the context of > an installation in progress, right? yes, the *what* is already in the man page of mount. I want to know *why*. > The existing paragraph explains that /proc is mounted ordinarily, and that > the others are binds, but doesn't elaborate why binds are used, why /sys and > /dev are rbinds while /run isn't. I had the exact same questing but I couldn't find anything explaining it on DDG. > If I could make one other suggestion, it would be to reorder the commands as: > mount --types proc /proc /mnt/gentoo/proc > mount --rbind /sys /mnt/gentoo/sys > mount --rbind /dev /mnt/gentoo/dev > mount --bind /run /mnt/gentoo/run > mount --make-rslave /mnt/gentoo/dev > mount --make-rslave /mnt/gentoo/sys > mount --make-slave /mnt/gentoo/run I like the idea of reordering the mount commands, it will make it less error prone.
Also curious to know the "why" AFAIK there are also dedicated mount options for /dev and /sys mount --types sysfs /sys /mnt/gentoo/sys mount --types devtmpfs /dev /mnt/gentoo/dev But the Handbook does use those. Also would be great to know why --make-rslave is neccessary for systemd but not OpenRC
(In reply to zyxhere from comment #3) > Also curious to know the "why" > AFAIK there are also dedicated mount options for /dev and /sys > mount --types sysfs /sys /mnt/gentoo/sys > mount --types devtmpfs /dev /mnt/gentoo/dev > > But the Handbook does use those. Also would be great to know why > --make-rslave is neccessary for systemd but not OpenRC *doesn't use those
Also to note that arch-chroot uses different mount options than the handbook: chroot_setup() { CHROOT_ACTIVE_MOUNTS=() [[ $(trap -p EXIT) ]] && die '(BUG): attempting to overwrite existing EXIT trap' trap 'chroot_teardown' EXIT chroot_add_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev && chroot_add_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro && ignore_error chroot_maybe_add_mount "[[ -d '$1/sys/firmware/efi/efivars' ]]" \ efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev && chroot_add_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid && chroot_add_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec && chroot_add_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev && chroot_add_mount /run "$1/run" -B --make-private && chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid }
I forgot to add what those flags do here: --bind : Remount part of the file hierarchy somewhere else. mount --bind olddir newdir --rbind : The entire file hierarchy including submounts can be attached a second place. mount --rbind olddir newdir --make-slave : A slave mount receives propagation from its master, but not vice versa. mount --make-slave mountpoint --make-rslave : recursively change the type of all the mounts under a given mountpoint. mount --make-rslave mountpoint *taken from man 8 mount*