Re: pivot_root off an initramfs broken

From: H. Peter Anvin (hpa_at_zytor.com)
Date: 12/04/03

  • Next message: Clemens Schwaighofer: "Re: XFS for 2.4"
    To: linux-kernel@vger.kernel.org
    Date:	3 Dec 2003 16:30:58 -0800
    
    

    Followup to: <1070496272.8280.443.camel@plato.i.bork.org>
    By author: Martin Hicks <mort@wildopensource.com>
    In newsgroup: linux.dev.kernel
    >
    > If I boot a 2.6 kernel that first execs /sbin/kinit on the initramfs,
    > does some setup (mostly to find the real root filesystem), then
    > pivot_roots over to the real root filesystem and execs /sbin/init the
    > kernel spins inside check_mnt() while mounting /proc in the initscripts.
    >

    The initramfs is the "real root" -- you shouldn't pivot_root from it,
    instead you should mount the new root on top of it.

    This makes cleaning up a bit of an issue -- the proposed rootfs
    mount_single patch takes care of that -- but it can also be done by
    leaving a cleanup process with cwd inside the initramfs with would use
    relative paths to clean up.

    Something like this:

              mount / /dev/real_root_whatever
              ( rm -rf . ) &
              exec /sbin/init "$@"

              -hpa

    -- 
    <hpa@transmeta.com> at work, <hpa@zytor.com> in private!
    If you send me mail in HTML format I will assume it's spam.
    "Unix gives you enough rope to shoot yourself in the foot."
    Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
    -
    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/
    

  • Next message: Clemens Schwaighofer: "Re: XFS for 2.4"