Hi Dutta,

On Mon, Oct 03, 2011 at 08:17:42PM +0530, Dutta, Kanishka wrote:
> When the system boots up, I am creating a new dir and mounting the separate 
> partition on top of this
> # mkdir newroot
> # mount dev/mmcblk0p14 newroot
> 
> whole of system partition gets mounted on newroot successfully, after that, I 
> give the command for switch_root :-
> 
> # switch_root newroot sbin/init
> switch_root: failed to mount moving /dev to newroot/dev: Invalid argument
> switch_root: forcing unmount of /dev
> switch_root: failed to mount moving /proc to newroot/proc: Invalid argument
> switch_root: forcing unmount of /proc
> switch_root: failed to mount moving /sys to newroot/sys: Invalid argument
> switch_root: forcing unmount of /sys
> switch_root: failed to mount moving newroot to /: No such file or directory
> switch_root: failed. Sorry.

You seem to be running the util-linux version of switch_root, not the Busybox 
one. In any case, give the absolute path in 'newroot', that is '/newroot', 
relative path won't work. See the source for why. Also, you should do

# exec switch_root /newroot /sbin/init

because you need to run the new /sbin/init as PID 1. This assumes that your 
shell is actually PID 1. If not, this won't work.

baruch

> ________________________________________
> From: Laurent Bercot [[email protected]]
> Sent: Monday, October 03, 2011 8:18 PM
> To: [email protected]
> Cc: Dutta, Kanishka
> Subject: Re: can't switch_root
> 
> > Yes, initially I am booting up with minimal initramfs.
> 
>  Well in that case you cannot use pivot_root, and have to use switch_root
> indeed.
>  (You could also clean up your filesystem by hand and then mount --move,
> but that offers no real benefit over using switch_root, which does exactly
> that for you.)
> 
>  Could you send the output of a strace of your switch_root command ?

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to