[PATCH f17-branch 2/2] copy installer image to RAM during upgrades (#810391)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When installing from a hard drive, loader used to copy install.img to
tmpfs and unmount the partition afterward. We're avoiding that (to save
RAM) and it works fine in most cases.

However: for preupgrade, stage2 is stored in /boot. When anaconda tries
to mount /boot for upgrading, it finds that it's already mounted, pops
up a "Fatal error" dialog, and exits.

So, a hack: if "preupgrade" or "upgrade" or "inst.upgrade" is in the
boot args, and we're getting the installer image from a disk, copy the
install image into tmpfs and unmount the disk before proceeding.
---
 dracut/anaconda-diskroot |    8 +++++++-
 dracut/anaconda-lib.sh   |    9 +++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/dracut/anaconda-diskroot b/dracut/anaconda-diskroot
index 612a131..eb4e838 100755
--- a/dracut/anaconda-diskroot
+++ b/dracut/anaconda-diskroot
@@ -13,4 +13,10 @@ path="$2" # optional, could be empty
 
 info "anaconda using disk root at $dev"
 mount $dev $repodir || warn "Couldn't mount $dev"
-anaconda_live_root_dir $repodir $path
+# HACK: umount $dev on upgrades so anaconda doesn't crash.
+# FIXME: make anaconda handle this cleanly (mount --rbind/--move)
+if getargbool 0 preupgrade upgrade inst.upgrade; then
+    anaconda_live_root_dir $repodir $path --copy-to-ram
+else
+    anaconda_live_root_dir $repodir $path
+fi
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index c469555..1ec80db 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -66,6 +66,15 @@ anaconda_live_root_dir() {
         mount -o loop,ro $iso $repodir
         img=$(find_runtime $repodir) || { warn "$iso has no suitable runtime"; }
     fi
+    # FIXME: make rd.live.ram clever enough to do this for us
+    if [ "$1" = "--copy-to-ram" ]; then
+        echo "Copying installer image to RAM..."
+        echo "(this may take a few minutes)"
+        cp $img /run/install/install.img
+        img=/run/install/install.img
+        umount $repodir
+        [ -n "$iso" ] && umount $isodir
+    fi
     [ -e "$img" ] && /sbin/dmsquash-live-root $img
 }
 
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux