[PATCH] Avoid using mount --move on shared paths (#853508)

Jesse Keating jkeating at redhat.com
Fri Oct 12 19:33:00 UTC 2012


move doesn't work because /run/ is a shared filesystem.  So do as
systemd suggests, mark the filesystem as private.  We don't know of any
reason in anaconda for the filesystem to be shared anyway.

This hack can go away if/when the kernel ever allows moving mounts
within a shared filesystem.
---
 dracut/anaconda-lib.sh             | 3 ++-
 pyanaconda/packaging/yumpayload.py | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 6b9a707..af6690d 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -54,7 +54,7 @@ anaconda_live_root_dir() {
     img=$(find_runtime $mnt/$path)
     if [ -n "$img" ]; then
         info "anaconda: found $img"
-        [ "$mnt" = "$repodir" ] || mount --move $mnt $repodir
+        [ "$mnt" = "$repodir" ] || { mount --rprivate /; mount --move $mnt $isodir; }
         anaconda_auto_updates $repodir/$path/images
     else
         if [ "${path%.iso}" != "$path" ]; then
@@ -65,6 +65,7 @@ anaconda_live_root_dir() {
         fi
         [ -n "$iso" ] || { warn "no suitable images"; return 1; }
         info "anaconda: found $iso"
+        mount --rprivate /
         mount --move $mnt $isodir
         iso=${isodir}/${iso#$mnt}
         mount -o loop,ro $iso $repodir
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index cd2e22e..49c586e 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -563,6 +563,10 @@ reposdir=%s
             # install from one of them
             if image:
                 # move the mount to ISO_DIR
+                # work around inability to move shared filesystems
+                iutil.execWithRedirect("mount",
+                                       ["--rprivate", "/"],
+                                       stderr="/dev/tty5", stdout="/dev/tty5")
                 iutil.execWithRedirect("mount",
                                        ["--move", INSTALL_TREE, ISO_DIR],
                                        stderr="/dev/tty5", stdout="/dev/tty5")
-- 
1.7.11.4



More information about the anaconda-patches mailing list