From: Konrad Scherer <konrad.sche...@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.sche...@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 _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core