Messages in this thread |  | | Date | Wed, 17 Oct 2001 11:34:05 -0700 | From | Eric <> | Subject | Re: [Q] pivot_root and initrd |
| |
>> >> Works great. I use it in my SuperRescue CD for example; you can >> there check out a complete, working example. >> >> ftp://ftp.kernel.org/pub/dist/superresuce/ >> >> -hpa
hpa,
Thanks for the example. The documentation for pivot_root must be just plain lousy-- I thought I'd go "by the book" with the following admonitions from the manpage:
1) cd to new_root prior to calling pivot_root 2) call pivot_root with relative new_root (.) and put_old 3) call 'chroot' immediately after pivot and redirect stdin/out
You are simply doing the following, I assume with success:
[ ... ] # Switch roots and run init cd /ram pivot_root /ram /ram/initrd exec /sbin/init "$@"
whereas I am doing something like the following:
[ ... ] mount -o ro $ROOTDEV $NEWROOT cd $NEWROOT pivot_root . $OLDROOT
# export for visibility to exec'ed shell export INITARGS="$@" export OLDROOT
exec chroot . sh -c 'umount $OLDROOT; exec -a init.new /sbin/init $INITARGS' <dev/console >dev/console 2>&1
I am mystified that the call to 'exec /sbin/init' works if you are using the standard (you mention "based on RedHat7.1" util-linux") /sbin/init proggie, and that a standard RH7.1 initscripts would not complain when the root filesystem is already mounted r/w.
I would also guess that you are susceptible to the kernel's change_root call if your /sbin/init terminates. I'll have to play with the disk a bit.
E
- 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/
|  |