[Wylug-help] Root device / pivot_root question

James Holden wylug at jamesholden.net
Sun Nov 7 10:17:38 GMT 2004


--
Note: I've actually solved this now, so this is for info only.

On Sat, 2004-11-06 at 16:48, Timothy Baldwin wrote:
[snip]

> > But then, when I:
> >
> > exec chroot . /sbin/init < dev/console >dev/console 2>&1
> >
> > ...I get:
> >
> > Usage: init 0123456SsQqAaBbCcUu
> > VFS: Cannot open root device "rd/0" or unknown-block(0,0)
> > Please append a correct "root=" boot option
> > Kernel panic: VFS Unable to mount root fs on unknown-block(0,0)
>
> init should be started with a process id of 1, and therefore cannot be started
> from /linuxrc
>
> Rename /linuxrc, and give the kernel the options root=/dev/ram0 init=<new name
> of /linuxrc>.

I tried this. It's a 2.6.7 kernel so there's other in-kernel processes
running before init would get the chance to start.

> > I think the problem is with init not working. Once init bombs, the old
> > change_root method kicks in, but finds it doesn't have a root to mount.
>
> I don't think the old change root method can be used with tmpfs, due to it not
> being mounted on a device. (nfs is a special case)

Correct. The old change_root method starting here (in the wrong
situation) is a side effect of the exec chroot failing.

The secret was to "echo 0x0100 > /proc/sys/kernel/real-root-dev" before
the end of /linuxrc to make the kernel think the root device is already
mounted. Init then runs as normal. That way the kernel won't try to
mount the root device specified in the kernel command line. If
/proc/sys/kernel/real-root-dev is 0 then it's assumed that the root
device needs to be mounted.

James


> - --
> Member AFFS, WYLUG, SWP (UK), ANL, RESPECT, Leeds SA, Leeds Anti-war coalition
> No to software patents!    Victory to the iraqi resistance!
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
>
> iD8DBQFBjQBSjXSPyZ9/z+QRAl3ZAJ9OxcSJShkay7nLAH1nLYO1iD3p0ACgsxAd
> p85G65B0+gHS9p01m3JY98U=
> =AA/9
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Wylug-help mailing list
> Wylug-help at wylug.org.uk
> http://list.wylug.org.uk/mailman/listinfo/wylug-help
--
Content-Description: This is a digitally signed message part

[ signature.asc of type application/pgp-signature deleted ]
--




More information about the Wylug-help mailing list