Revised chroot command in lfs-cvs

Gerard Beekmans gerard at linuxfromscratch.org
Sat Apr 26 11:29:52 PDT 2003


On April 26, 2003 06:50 am, Neven Has wrote:
> No, nothing is hardcoded, it's simply not used.  Only the root
> directory is changed, using chroot(2).

Maybe an idea to allow a tag to specify which command to run when going into 
chroot? There's not much use for that probably, but every now and then I 
enter chroot using 'strace /bin/bash' to see what's going on (it's a handy 
debugging feature). It can be done of course by making $LFS/bin/sh a symlink 
to strace, and call /bin/bash inside chroot then, but that's a lot of work. 
It'd be simpler to specify this in the <stageinfo> block.

> So the right thing should happen, as /static/bin is not used in
> revised chroot.  Haven't tried it myself yet though...

So to make this work reliable, when Glibc is installed for the second time in 
Chapter 6 we should wrap the remaining profiles in a new stageinfo that 
doens't include /static/bin? We just don't want /static/bin to appear in the 
PATH (simply because it feels better).

Here, let me demonstrate with some code (code means more than a thousand words 
afterall);

<stage name="Chapter 6">
        <stageinfo>
                <root>&LFS;</root>

                <environment>
                        <variable name="PATH">
                                /bin:/usr/bin:/sbin:/usr/sbin:/static/bin
                        </variable>
                        <variable name="HOME">
                                /root
                        </variable>
                </environment>
        </stageinfo>

        &ch6-chown;
        &ch6-creating_dirs;
        &ch6-makedev;
        ....
        &ch6-glibc-pass2;
</stage>

<stage name="Chapter 6 Revised Chroot and up">
        <stageinfo>
                <root>&LFS;</root>

                <environment>
                        <variable name="PATH">
                                /bin:/usr/bin:/sbin:/usr/sbin
                        </variable>
                        <variable name="HOME">
                                /root
                        </variable>
                </environment>
        </stageinfo>
	&ch6-lfs-bootscripts;
	&ch6-config-keyboard;
	&ch6-create-rootpwd;
</stage>

Again there's not real technical reason for this since as long as /bin and 
/usr/bin appear in $PATH first, all is well (manually installing uses a 
chroot'ed shell which will fail if the old chroot command it used, but should 
not be an issue with nALFS).



-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list