source: chapter06/chroot.xml@ a9fde34e

Last change on this file since a9fde34e was 6a0e6f3, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • Remove the spurious <info> tags that I thought were necessary but evidently aren't

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/LFS-RNG/BOOK@4387 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
[1fe35e1]2<!DOCTYPE section [
[673b0d8]3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
[1fe35e1]6<section xmlns="http://docbook.org/docbook-ng"
7 xml:id="ch-system-chroot">
[6a0e6f3]8<title>Entering the chroot environment</title>
[673b0d8]9<?dbhtml filename="chroot.html"?>
10
11<para>It is time to enter the chroot environment in order to begin building
12and installing your final LFS system. Still as <emphasis>root</emphasis> run
13the following command to enter the small world that is, at the moment,
14populated with only the temporary tools:</para>
15
16<screen><userinput>chroot "$LFS" /tools/bin/env -i \
17 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
18 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
19 /tools/bin/bash --login +h</userinput></screen>
20
[3c928f1]21<para>The <parameter>-i</parameter> option given to the
[673b0d8]22<command>env</command> command will clear all variables of the chroot
23environment. After that, only the HOME, TERM, PS1 and PATH variables are
[3c928f1]24set again. The <parameter>TERM=$TERM</parameter> construct will set the TERM variable inside chroot
[673b0d8]25to the same value as outside chroot; this variable is needed for programs
26like <command>vim</command> and <command>less</command> to operate
27properly. If you need other variables present, such as CFLAGS or CXXFLAGS,
28this is a good place to set them again.</para>
29
30<para>From this point on there's no need to use the LFS variable anymore,
31because everything you do will be restricted to the LFS file system -- since
32what the shell thinks is <filename class="directory">/</filename> is actually
33the value of <filename class="directory">$LFS</filename>, which was passed to
34the chroot command.</para>
35
36<para>Notice that <filename class="directory">/tools/bin</filename> comes
37last in the PATH. This means that a temporary tool will not be used any more
38as soon as its final version is installed. Well, at least when the shell
39doesn't remember the locations of executed binaries -- for this reason hashing
[3c928f1]40is switched off by passing the <parameter>+h</parameter> option to
[673b0d8]41<command>bash</command>.</para>
42
43<para>You have to make sure all the commands in the rest of this chapter and
44in the following chapters are run from within the chroot environment.
45If you ever leave this environment for any reason (rebooting for example),
[3c928f1]46you must remember to first mount the <systemitem class="filesystem">proc</systemitem>
47and <systemitem class="filesystem">devpts</systemitem> file systems (discussed
[673b0d8]48in the previous section) <emphasis>and</emphasis> enter chroot again before
49continuing with the installations.</para>
50
[3c928f1]51<para>Note that the <command>bash</command> prompt will say
52<computeroutput>I have no name!</computeroutput> This is
[673b0d8]53normal, as the <filename>/etc/passwd</filename> file has not been created yet.
54</para>
55
[1fe35e1]56</section>
Note: See TracBrowser for help on using the repository browser.