can't switch_root

Dutta, Kanishka kanishka.dutta at ti.com
Tue Oct 4 08:42:35 UTC 2011


Hi Baruch,

Thanks for your inputs. I tried with exec switch_root /newroot /sbin/init (as you suggested, but getting this issue:-

# exec switch_root /newroot /sbin/init
udevd[108]: specified group 'dialout' unknown
udevd[108]: specified group 'disk' unknown
udevd[108]: specified group 'tty' unknown
udevd[108]: specified group 'kmem' unknown
udevd[108]: specified group 'video' unknown
udevd[108]: specified group 'audio' unknown
udevd[108]: specified group 'lp' unknown
udevd[108]: specified group 'floppy' unknown
udevd[108]: specified group 'cdrom' unknown
udevd[108]: specified group 'tape' unknown
Usage: init 0123udevd[108]: specified group 'plugdev' unknown
udevd[108]: specified group 'users' unknown

After this the console hangs and I am unable to get any kernel prompt beyond this point.

Regards,
Kanishka Dutta
________________________________________
From: Baruch Siach [baruch at tkos.co.il]
Sent: Monday, October 03, 2011 9:19 PM
To: Dutta, Kanishka
Cc: Laurent Bercot; busybox at busybox.net
Subject: Re: can't switch_root

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 [ska-dietlibc at skarnet.org]
> Sent: Monday, October 03, 2011 8:18 PM
> To: busybox at busybox.net
> 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------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the busybox mailing list