summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2013-02-22 18:26:30 -0500
committerWill Woods <wwoods@redhat.com>2013-02-26 12:32:50 -0500
commit47c6635992e21270841c80ff62ff3c8eed38d5df (patch)
tree90087378b721e10a88676ff395cfef952ece1dba
parentd42bd03f491955bb124f9fc87a4effce62abbdb5 (diff)
downloadanaconda-47c6635992e21270841c80ff62ff3c8eed38d5df.tar.gz
anaconda-47c6635992e21270841c80ff62ff3c8eed38d5df.tar.xz
anaconda-47c6635992e21270841c80ff62ff3c8eed38d5df.zip
dracut: add anaconda-pre-shutdown.sh to fix eject (#809920)
So it turns out that having the device that contains the runtime image mounted *underneath* the runtime image means we have a mount loop, e.g.: The DVD can't be unmounted because it holds the image for / / can't be unmounted because the DVD is mounted underneath it To fix this, we move the repo mount(s) back out from under the runtime image during dracut's pre-shutdown hook (new in dracut 024-25).
-rw-r--r--anaconda.spec.in2
-rw-r--r--dracut/Makefile.am3
-rw-r--r--dracut/anaconda-pre-shutdown.sh21
-rwxr-xr-xdracut/module-setup.sh1
4 files changed, 25 insertions, 2 deletions
diff --git a/anaconda.spec.in b/anaconda.spec.in
index a6551b971..b8b313479 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -34,7 +34,7 @@ Source0: %{name}-%{version}.tar.bz2
%define firewalldver 0.2.9-1
%define pythonurlgrabberver 3.9.1-5
%define utillinuxver 2.15.1
-%define dracutver 024-16
+%define dracutver 024-25
%define isomd5sum 1.0.10
BuildRequires: audit-libs-devel
diff --git a/dracut/Makefile.am b/dracut/Makefile.am
index 7646e2377..53a30cbe7 100644
--- a/dracut/Makefile.am
+++ b/dracut/Makefile.am
@@ -39,7 +39,8 @@ dist_dracut_SCRIPTS = module-setup.sh \
fetch-updates-disk \
parse-kickstart \
anaconda-modprobe.sh \
- save-initramfs.sh
+ save-initramfs.sh \
+ anaconda-pre-shutdown.sh
MAINTAINERCLEANFILES = Makefile.in
diff --git a/dracut/anaconda-pre-shutdown.sh b/dracut/anaconda-pre-shutdown.sh
new file mode 100644
index 000000000..2b977861b
--- /dev/null
+++ b/dracut/anaconda-pre-shutdown.sh
@@ -0,0 +1,21 @@
+# Fix mount loops that prevent unmount/eject.
+#
+# During startup, we mount our repo (e.g. the DVD) at $repodir or $isodir.
+# We then mount the runtime image from that repo at /newroot and switch into it.
+# Switching moves $repodir to /newroot/$repodir, which creates a mount loop:
+#
+# -> You can't unmount the runtime image because the DVD is mounted under it
+# -> You can't unmount the DVD because it holds the mounted runtime image
+#
+# And now you can't unmount or eject the DVD!
+#
+# We fix this by moving the repo mounts back out from under the runtime image
+# during shutdown. Then everything can be unmounted like normal.
+
+. /lib/anaconda-lib.sh
+
+for mnt in $repodir $isodir; do
+ # systemd-shutdown puts old root at /oldroot
+ oldmnt=/oldroot$mnt
+ grep -qw $oldmnt /proc/mounts && mount --move $oldmnt $mnt
+done
diff --git a/dracut/module-setup.sh b/dracut/module-setup.sh
index d196963c5..9d21bcffd 100755
--- a/dracut/module-setup.sh
+++ b/dracut/module-setup.sh
@@ -34,6 +34,7 @@ install() {
inst_hook pre-pivot 50 "$moddir/anaconda-copy-ks.sh"
inst_hook pre-pivot 50 "$moddir/anaconda-copy-cmdline.sh"
inst_hook pre-pivot 99 "$moddir/save-initramfs.sh"
+ inst_hook pre-shutdown 50 "$moddir/anaconda-pre-shutdown.sh"
# kickstart parsing, WOOOO
inst_hook initqueue/online 10 "$moddir/fetch-kickstart-net.sh"
inst "$moddir/fetch-kickstart-disk" "/sbin/fetch-kickstart-disk"