Try to move /sys and /proc to the newroot first instead of just unmounting.
authorPeter Hjalmarsson <xake@rymdraket.net>
Thu, 24 Mar 2011 12:36:56 +0000 (13:36 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 28 Mar 2011 17:31:57 +0000 (19:31 +0200)
defaults/linuxrc

index 115f1f52aad2bfb0ac50a2471866cac7121cafbc..1819d9f7923b16ed573208f3f7ce51046f957160 100755 (executable)
@@ -733,16 +733,17 @@ echo -ne "${BOLD}.${NORMAL}"
 
 # If devtmpfs is mounted, try move it to the new root
 # If that fails, try to unmount all possible mounts of devtmpfs as stuff breaks otherwise
-if grep -qs "/dev " /proc/mounts
-then
-       if ! mount --move /dev "${CHROOT}"/dev
+for fs in /dev /sys /proc
+do
+       if grep -qs "$fs" /proc/mounts
        then
-               umount /dev || echo '*: Failed to move and unmount the ramdisk /dev!'
+               if ! mount --move $fs "${CHROOT}"$fs
+               then
+                       umount $fs || echo '*: Failed to move and unmount the ramdisk $fs!'
+               fi
        fi
-fi
+done
 
-umount /sys || echo '*: Failed to unmount the ramdisk /sys!'
-umount /proc || echo '*: Failed to unmount the ramdisk /proc!'
 echo -e "${BOLD}.${NORMAL}"
 
 exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" "${INIT_OPTS}"