Need help to umount initrd and mount real file system

Denis Vlasenko vda.linux at googlemail.com
Tue Feb 6 00:48:45 UTC 2007


On Monday 05 February 2007 15:11, Rupesh Gujare wrote:
> 
> I had tried with pivot_root:
>  I entered 
> /bin/sh  in /etc/rcS
> and after mounting /proc tried to do pivot_root
>  it gives me 
> pivot_root:pivot_root: Device or resource busy.
>  any clue why it is like this?

Oh, wonderful problem report. No solid info on what exactly
you did (params to pivot_root etc...).

Anyway, a part of my homemade initrd whcu does pivot_root
(bu this time "new" rootfs is mounted on /new_root):


# Clean up
#umount /sys
umount /proc

echo "# Chrooting into root fs"
# we expect that /dev/console and /dev/null exist in /new_root/dev
cd /new_root
# making sure we dont keep /dev busy
exec <dev/console >dev/console 2>&1
# proc/ in new root is used here as a temp mountpoint for old root
pivot_root . proc || {
    echo "pivot_root failed. Fatal, cannot continue booting"
    while true; do sleep 32000; done
}

exec \
chroot . \
sh -c '\
umount -n /proc || { echo "! error unmounting initrd fs, continuing"; sleep 10; }
exec /bin/env - /sbin/init
'

echo "chroot . sh failed. Fatal, cannot continue booting"
while true; do sleep 32000; done


Hope this helps
--
vda



More information about the busybox mailing list