From cb24bedd073f23ac518bc1c0b79aec4593db2817 Mon Sep 17 00:00:00 2001 From: Peter Hjalmarsson Date: Tue, 1 Feb 2011 19:34:54 +0100 Subject: [PATCH] Move dev to chroot This can be considered good practice, likely less chance that nodes created in the ramdisk disapperes when switching root. Some applications (mostly debugging/benchmarking) also needs this to survive the switch_root. --- defaults/linuxrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index ee33a35..88eed00 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -725,10 +725,14 @@ cd "${CHROOT}" mkdir "${CHROOT}/proc" "${CHROOT}/sys" 2>/dev/null echo -ne "${BOLD}.${NORMAL}" -# If devtmpfs is mounted assume genkernel mounted it at /dev and try unmounting it +# 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 devtmpfs /proc/mounts then - umount /dev || echo '*: Failed to unmount the devtmpfs /dev!' + if ! mount --move /dev "${CHROOT}"/dev + then + umount -a -t devtmpfs || echo '*: Failed to move and unmount the devtmpfs /dev!' + fi fi umount /sys || echo '*: Failed to unmount the ramdisk /sys!' -- 2.26.2