Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   copy installer image to RAM during upgrades (#810391) (http://www.linux-archive.org/debian-kernel/653186-copy-installer-image-ram-during-upgrades-810391-a.html)

Will Woods 04-05-2012 10:56 PM

copy installer image to RAM during upgrades (#810391)
 
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 08:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.