From 5713bc08ed108275c26dbbdd61a5492583feeade Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sun, 16 Jan 2022 08:33:14 -0500 Subject: [PATCH] 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 Signed-off-by: Richard Laager --- .../Debian/Debian Bullseye Root on ZFS.rst | 12 ++++++------ .../Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst | 10 +++++----- .../Ubuntu/Ubuntu 20.04 Root on ZFS.rst | 12 ++++++------ .../openSUSE/openSUSE Leap Root on ZFS.rst | 12 ++++++------ .../openSUSE/openSUSE Tumbleweed Root on ZFS.rst | 12 ++++++------ 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst b/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst index e69a3d6..4c76488 100644 --- a/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst +++ b/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst @@ -584,9 +584,9 @@ Step 4: System Configuration #. Bind the virtual filesystems from the LiveCD environment to the new system and ``chroot`` into it:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys chroot /mnt /usr/bin/env DISK=$DISK bash --login **Note:** This is using ``--rbind``, not ``--bind``. @@ -1095,9 +1095,9 @@ Mount everything correctly:: If needed, you can chroot into your installed environment:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys mount -t tmpfs tmpfs /mnt/run mkdir /mnt/run/lock chroot /mnt /bin/bash --login diff --git a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst index f5e0492..5ba70d4 100644 --- a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst +++ b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst @@ -581,11 +581,11 @@ Step 4: System Configuration #. Bind the virtual filesystems from the running environment to the new ZFS environment and ``chroot`` into it:: - mount --rbind /boot/firmware /mnt/boot/firmware - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /run /mnt/run - mount --rbind /sys /mnt/sys + mount --make-private --rbind /boot/firmware /mnt/boot/firmware + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /run /mnt/run + mount --make-private --rbind /sys /mnt/sys chroot /mnt /usr/bin/env DISK=$DISK UUID=$UUID bash --login #. Configure a basic system environment:: diff --git a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst index a72cbde..67d76a9 100644 --- a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst +++ b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst @@ -719,9 +719,9 @@ Step 4: System Configuration #. Bind the virtual filesystems from the LiveCD environment to the new system and ``chroot`` into it:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys chroot /mnt /usr/bin/env DISK=$DISK UUID=$UUID bash --login **Note:** This is using ``--rbind``, not ``--bind``. @@ -1216,9 +1216,9 @@ Mount everything correctly:: If needed, you can chroot into your installed environment:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys mount -t tmpfs tmpfs /mnt/run mkdir /mnt/run/lock chroot /mnt /bin/bash --login diff --git a/docs/Getting Started/openSUSE/openSUSE Leap Root on ZFS.rst b/docs/Getting Started/openSUSE/openSUSE Leap Root on ZFS.rst index cf902a1..1a98497 100644 --- a/docs/Getting Started/openSUSE/openSUSE Leap Root on ZFS.rst +++ b/docs/Getting Started/openSUSE/openSUSE Leap Root on ZFS.rst @@ -625,9 +625,9 @@ Step 5: System Configuration #. Bind the virtual filesystems from the LiveCD environment to the new system and ``chroot`` into it:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys mount -t tmpfs tmpfs /mnt/run mkdir /mnt/run/lock @@ -1173,9 +1173,9 @@ Mount everything correctly:: If needed, you can chroot into your installed environment:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys chroot /mnt /bin/bash --login mount /boot mount -a diff --git a/docs/Getting Started/openSUSE/openSUSE Tumbleweed Root on ZFS.rst b/docs/Getting Started/openSUSE/openSUSE Tumbleweed Root on ZFS.rst index edba1be..ab43eaf 100644 --- a/docs/Getting Started/openSUSE/openSUSE Tumbleweed Root on ZFS.rst +++ b/docs/Getting Started/openSUSE/openSUSE Tumbleweed Root on ZFS.rst @@ -624,9 +624,9 @@ Step 5: System Configuration #. Bind the virtual filesystems from the LiveCD environment to the new system and ``chroot`` into it:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys mount -t tmpfs tmpfs /mnt/run mkdir /mnt/run/lock @@ -1152,9 +1152,9 @@ Mount everything correctly:: If needed, you can chroot into your installed environment:: - mount --rbind /dev /mnt/dev - mount --rbind /proc /mnt/proc - mount --rbind /sys /mnt/sys + mount --make-private --rbind /dev /mnt/dev + mount --make-private --rbind /proc /mnt/proc + mount --make-private --rbind /sys /mnt/sys chroot /mnt /bin/bash --login mount /boot mount -a