Changeset e6ab4b5 for chapter06/chroot.xml
- Timestamp:
- 02/03/2006 06:23:22 PM (18 years ago)
- Children:
- fa994c9
- Parents:
- b4cd3c5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter06/chroot.xml
rb4cd3c5 re6ab4b5 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-system-chroot"> 7 <title>Entering the Chroot Environment</title> 8 <?dbhtml filename="chroot.html"?> 9 <?dbhtml filename="chroot.html"?> 9 10 10 <para>It is time to enter the chroot environment to begin 11 building and installing the final LFS system. As user 12 <emphasis>root</emphasis>, run the following command to enter the 13 realm that is, at the moment, populated with only the temporary 14 tools:</para> 11 <title>Entering the Chroot Environment</title> 12 13 <para>It is time to enter the chroot environment to begin building and 14 installing the final LFS system. As user <systemitem 15 class="username">root</systemitem>, run the following command to enter the 16 realm that is, at the moment, populated with only the temporary tools:</para> 15 17 16 18 <screen><userinput>chroot "$LFS" /tools/bin/env -i \ … … 19 21 /tools/bin/bash --login +h</userinput></screen> 20 22 21 <para>The <parameter>-i</parameter> option given to the 22 <command>env</command> command will clear all variables of the chroot 23 environment. After that, only the <envar>HOME</envar>, 24 <envar>TERM</envar>, <envar>PS1</envar>, and 25 <envar>PATH</envar> variables are set again. The 26 <parameter>TERM=$TERM</parameter> construct will set the 27 <envar>TERM</envar> variable inside chroot to the same value as 28 outside chroot. This variable is needed for programs like 29 <command>vim</command> and <command>less</command> to operate 30 properly. If other variables are needed, such as 31 <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is 32 a good place to set them again.</para> 23 <para>The <parameter>-i</parameter> option given to the <command>env</command> 24 command will clear all variables of the chroot environment. After that, only 25 the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and 26 <envar>PATH</envar> variables are set again. The 27 <parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar> 28 variable inside chroot to the same value as outside chroot. This variable is 29 needed for programs like <command>vim</command> and <command>less</command> 30 to operate properly. If other variables are needed, such as 31 <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set 32 them again.</para> 33 33 34 <para>From this point on, there is no need to use the35 <envar>LFS</envar> variable anymore, because all work will be 36 restricted to the LFS file system. This is because the Bash shell is 37 told that<filename class="directory">$LFS</filename> is now the root38 (<filename class="directory">/</filename>) directory.</para>34 <para>From this point on, there is no need to use the 35 <envar>LFS</envar> variable anymore, because all work will be restricted 36 to the LFS file system. This is because the Bash shell is told that 37 <filename class="directory">$LFS</filename> is now the root 38 (<filename class="directory">/</filename>) directory.</para> 39 39 40 <para>Notice that <filename class="directory">/tools/bin</filename> comes last41 in the <envar>PATH</envar>. This means that a temporary tool will no longer be42 used once its final version is installed. This occurs when the shell does not43 <quote>remember</quote> the locations of executed binaries—for this44 reason, hashing is switched off by passing the <parameter>+h</parameter> option45 to <command>bash</command>.</para>40 <para>Notice that <filename class="directory">/tools/bin</filename> comes last 41 in the <envar>PATH</envar>. This means that a temporary tool will no longer be 42 used once its final version is installed. This occurs when the shell does not 43 <quote>remember</quote> the locations of executed binaries—for this 44 reason, hashing is switched off by passing the <parameter>+h</parameter> option 45 to <command>bash</command>.</para> 46 46 47 <para>It is important that all the commands throughout the remainder 48 of this chapter and the following chapters are run from within the 49 chroot environment. If you leave this environment for any reason 50 (rebooting for example), remember to first mount the <systemitem 51 class="filesystem">proc</systemitem> and <systemitem 52 class="filesystem">devpts</systemitem> file systems (discussed in the 53 previous section) and enter chroot again before continuing with the 54 installations.</para> 47 <para>It is important that all the commands throughout the remainder of this 48 chapter and the following chapters are run from within the chroot environment. 49 If you leave this environment for any reason (rebooting for example), remember 50 to first mount the <systemitem class="filesystem">proc</systemitem> and 51 <systemitem class="filesystem">devpts</systemitem> file systems (discussed 52 in the previous section) and enter chroot again before continuing with the 53 installations.</para> 55 54 56 <para>Note that the <command>bash</command> prompt will say57 <computeroutput>I have no name!</computeroutput> This is normal because the58 <filename>/etc/passwd</filename> file has not been created yet.</para>55 <para>Note that the <command>bash</command> prompt will say 56 <computeroutput>I have no name!</computeroutput> This is normal because the 57 <filename>/etc/passwd</filename> file has not been created yet.</para> 59 58 60 59 </sect1> 61
Note:
See TracChangeset
for help on using the changeset viewer.