Use 'private' bind mounts

When plain '--rbind' is used, the 'umount' process executed later in the
setup process completely unmounts the bound filesystem, resulting in various
forms of breakage on the host used to do the setup. When a Live CD is used
and the system will be immediately shutdown/rebooted, this isn't an issue,
but in other scenarios it can be problematic.

Making the bind mounts 'private' avoids this problem. This patch changes
the setup guides for 'modern' distribution versions but does not touch
the older ones where this functionality may not be available.

Signed-off-by: Kevin P. Fleming <kevin@km6g.us>
Signed-off-by: Richard Laager <rlaager@wiktel.com>
This commit is contained in:
Kevin P. Fleming
2022-01-16 08:33:14 -05:00
committed by Richard Laager
parent 7b974c4181
commit 5713bc08ed
5 changed files with 29 additions and 29 deletions

View File

@@ -584,9 +584,9 @@ Step 4: System Configuration
#. Bind the virtual filesystems from the LiveCD environment to the new #. Bind the virtual filesystems from the LiveCD environment to the new
system and ``chroot`` into it:: system and ``chroot`` into it::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
chroot /mnt /usr/bin/env DISK=$DISK bash --login chroot /mnt /usr/bin/env DISK=$DISK bash --login
**Note:** This is using ``--rbind``, not ``--bind``. **Note:** This is using ``--rbind``, not ``--bind``.
@@ -1095,9 +1095,9 @@ Mount everything correctly::
If needed, you can chroot into your installed environment:: If needed, you can chroot into your installed environment::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
mount -t tmpfs tmpfs /mnt/run mount -t tmpfs tmpfs /mnt/run
mkdir /mnt/run/lock mkdir /mnt/run/lock
chroot /mnt /bin/bash --login chroot /mnt /bin/bash --login

View File

@@ -581,11 +581,11 @@ Step 4: System Configuration
#. Bind the virtual filesystems from the running environment to the new #. Bind the virtual filesystems from the running environment to the new
ZFS environment and ``chroot`` into it:: ZFS environment and ``chroot`` into it::
mount --rbind /boot/firmware /mnt/boot/firmware mount --make-private --rbind /boot/firmware /mnt/boot/firmware
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /run /mnt/run mount --make-private --rbind /run /mnt/run
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
chroot /mnt /usr/bin/env DISK=$DISK UUID=$UUID bash --login chroot /mnt /usr/bin/env DISK=$DISK UUID=$UUID bash --login
#. Configure a basic system environment:: #. Configure a basic system environment::

View File

@@ -719,9 +719,9 @@ Step 4: System Configuration
#. Bind the virtual filesystems from the LiveCD environment to the new #. Bind the virtual filesystems from the LiveCD environment to the new
system and ``chroot`` into it:: system and ``chroot`` into it::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
chroot /mnt /usr/bin/env DISK=$DISK UUID=$UUID bash --login chroot /mnt /usr/bin/env DISK=$DISK UUID=$UUID bash --login
**Note:** This is using ``--rbind``, not ``--bind``. **Note:** This is using ``--rbind``, not ``--bind``.
@@ -1216,9 +1216,9 @@ Mount everything correctly::
If needed, you can chroot into your installed environment:: If needed, you can chroot into your installed environment::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
mount -t tmpfs tmpfs /mnt/run mount -t tmpfs tmpfs /mnt/run
mkdir /mnt/run/lock mkdir /mnt/run/lock
chroot /mnt /bin/bash --login chroot /mnt /bin/bash --login

View File

@@ -625,9 +625,9 @@ Step 5: System Configuration
#. Bind the virtual filesystems from the LiveCD environment to the new #. Bind the virtual filesystems from the LiveCD environment to the new
system and ``chroot`` into it:: system and ``chroot`` into it::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
mount -t tmpfs tmpfs /mnt/run mount -t tmpfs tmpfs /mnt/run
mkdir /mnt/run/lock mkdir /mnt/run/lock
@@ -1173,9 +1173,9 @@ Mount everything correctly::
If needed, you can chroot into your installed environment:: If needed, you can chroot into your installed environment::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
chroot /mnt /bin/bash --login chroot /mnt /bin/bash --login
mount /boot mount /boot
mount -a mount -a

View File

@@ -624,9 +624,9 @@ Step 5: System Configuration
#. Bind the virtual filesystems from the LiveCD environment to the new #. Bind the virtual filesystems from the LiveCD environment to the new
system and ``chroot`` into it:: system and ``chroot`` into it::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
mount -t tmpfs tmpfs /mnt/run mount -t tmpfs tmpfs /mnt/run
mkdir /mnt/run/lock mkdir /mnt/run/lock
@@ -1152,9 +1152,9 @@ Mount everything correctly::
If needed, you can chroot into your installed environment:: If needed, you can chroot into your installed environment::
mount --rbind /dev /mnt/dev mount --make-private --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc mount --make-private --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys mount --make-private --rbind /sys /mnt/sys
chroot /mnt /bin/bash --login chroot /mnt /bin/bash --login
mount /boot mount /boot
mount -a mount -a