pivot_root & linuxrc problem

Art Boulatov (art@ksu.ru)
Thu, 15 Mar 2001 16:16:10 +0300


Hi,

may be thats a bug, or I'm doing something really wrong :)

from Documentation/initrd.txt:

"# cd /new-root
# mkdir initrd
# pivot_root . initrd

Now, the linuxrc process may still access the old root via its
executable, shared libraries, standard input/output/error, and its
current root directory. All these references are dropped by the
following command:

# exec chroot . what-follows <dev/console >dev/console 2>&1

Where what-follows is a program under the new root, e.g. /sbin/init"

How can I "exec /sbin/init" from "/linuxrc", whatever it is,
if "linuxrc" does not get PID=1?

Actually, why does NOT "linuxrc" get PID=1?

A task list after booting with "root=/dev/rd/0" and "init=/linuxurc",
where "linuxrc" is simply "bash", shows that:
"swapper" got PID=1,
next come other kernel threads with a parent PID=1,
and "linuxrc" got PID=7 and a parent PID=1.

"init" sees it does not have PID=1 and simply bails out, next happens this:

"Note: if linuxrc or any program exec'ed from it terminates for some
reason, the old change_root mechanism is invoked (see section "Obsolete
root change mechanism")."

I probably misunderstand something here,
but could you please help?

In summary:

What is "swapper" and why does it get PID=1 and "linuxrc" does not?
If it is supposed to be that way, how do I "exec /sbin/init" from
"linuxrc" then?
Also why "/linuxrc" is hardcoded in init/main.c,
so telling kernel "root=/dev/rd/0 init=/sbin/whatever" does still invoke
"/linuxrc"?

Thanks a lot,
Art.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/