From: Konrad Scherer <konrad.scherer@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH] Unmount filesystems automounted by udev except the one with the rootfs
Date: Fri, 15 Feb 2013 16:04:52 -0500 [thread overview]
Message-ID: <1360962292-5445-1-git-send-email-konrad.scherer@windriver.com> (raw)
From: Konrad Scherer <Konrad.Scherer@windriver.com>
Unmount all filesystems automounted by udev except one with
rootfs since the filesystem will be destroyed by switch_root.
Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
---
meta/recipes-core/initrdscripts/files/init-live.sh | 21 ++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 4f8618b..21939ad 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -75,6 +75,8 @@ read_args() {
}
boot_live_root() {
+ local rootfs_dev=$1
+
killall udevd 2>/dev/null
# Move the mount points of some filesystems over to
@@ -82,8 +84,19 @@ boot_live_root() {
mount -n --move /proc ${ROOT_MOUNT}/proc
mount -n --move /sys ${ROOT_MOUNT}/sys
mount -n --move /dev ${ROOT_MOUNT}/dev
- # Move /media/$i over to the real root filesystem
- mount -n --move /media/$i ${ROOT_MOUNT}/media/realroot
+
+ # umount all filesystems automounted by udev except one with
+ # rootfs since the filesystem will be destroyed by switch_root
+ # They cannot be moved, because the read only rootfs may not have
+ # the corresponding mount points
+ for dir in `ls /media 2>/dev/null`; do
+ if [ "x${dir}" != "x${rootfs_dev}" ]; then
+ umount /media/${dir}
+ else
+ # Move iso mount with rootfs over to the real root filesystem
+ mount -n --move /media/${rootfs_dev} ${ROOT_MOUNT}/media/realroot
+ fi
+ done
cd $ROOT_MOUNT
exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
@@ -149,13 +162,13 @@ case $label in
mkdir /cow
mount -t tmpfs -o rw,noatime,mode=755 tmpfs /cow
mount -t unionfs -o dirs=/cow:/rootfs-tmp=ro unionfs $ROOT_MOUNT
- boot_live_root
+ boot_live_root $i
fi
else
if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
fatal "Could not mount rootfs image"
else
- boot_live_root
+ boot_live_root $i
fi
fi
;;
--
1.7.10.4
reply other threads:[~2013-02-16 0:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360962292-5445-1-git-send-email-konrad.scherer@windriver.com \
--to=konrad.scherer@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox