Hardened Linux From Scratch - Version SVN-20110904

Chapter 6. Installing Basic System Software

6.4. Entering
the Chroot Environment

It is time to enter the chroot environment to begin building and
installing the final LFS system. As user root, run the following command to enter the
realm that is, at the moment, populated with only the temporary
tools:

The -i option given to the
env command will clear
all variables of the chroot environment. After that, only the
HOME, TERM,
PS1, and PATH
variables are set again. The TERM=$TERM construct will set the
TERM variable inside chroot to the same
value as outside chroot. This variable is needed for programs like
vim and less to operate properly. If other
variables are needed, such as CFLAGS or
CXXFLAGS, this is a good place to set them
again.

From this point on, there is no need to use the LFS variable anymore, because all work will be
restricted to the LFS file system. This is because the Bash shell is
told that $HLFS is now the root
(/) directory.

Notice that /tools/bin comes last in
the PATH. This means that a temporary tool
will no longer be used once its final version is installed. This
occurs when the shell does not “remember” the locations of executed
binaries—for this reason, hashing is switched off by passing
the +h option to bash.

Note that the bash
prompt will say I have no name!
This is normal because the /etc/passwd
file has not been created yet.