source: chapter06/chroot.xml@ 7566baf

6.0
Last change on this file since 7566baf was 3e944d6, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Tags corrections.chapter06/aboutdebug.xml

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

  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<sect1 id="ch-system-chroot">
[69993f4]7<title>Entering the Chroot Environment</title>
[673b0d8]8<?dbhtml filename="chroot.html"?>
9
[69993f4]10<para>It is time to enter the chroot environment to begin
[ef13657]11building and installing the final LFS system. As user
12<emphasis>root</emphasis>, run the following command to enter the
13realm that is, at the moment, populated with only the temporary
14tools:</para>
[673b0d8]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
[752f4e5]23environment. After that, only the <envar>HOME</envar>,
24<envar>TERM</envar>, <envar>PS1</envar>, and
25<envar>PATH</envar> variables are set again. The
[ef13657]26<parameter>TERM=$TERM</parameter> construct will set the
[752f4e5]27<envar>TERM</envar> variable inside chroot to the same value as
[ef13657]28outside chroot. This variable is needed for programs like
29<command>vim</command> and <command>less</command> to operate
30properly. If other variables are needed, such as
[752f4e5]31<envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is
[ef13657]32a good place to set them again.</para>
33
[69993f4]34<para>From this point on, there is no need to use the
[752f4e5]35<envar>LFS</envar> variable anymore, because all work will be
[ef13657]36restricted to the LFS file system. This is because the Bash shell is
37told that <filename class="directory">$LFS</filename> is now the root
38(<filename class="directory">/</filename>) directory.</para>
39
[752f4e5]40<para>Notice that <filename class="directory">/tools/bin</filename>
41comes last in the <envar>PATH</envar>. This means that a
[ef13657]42temporary tool will not be used anymore as soon as its final version
43is installed. This occurs when the shell does not <quote>remember</quote> the
[69993f4]44locations of executed binaries&mdash;for this reason, hashing is switched
[3e944d6]45off by passing the <parameter>+h</parameter> option to <command>bash</command>.</para>
[ef13657]46
47<para>It is important that all the commands throughout the remainder
[69993f4]48of this chapter and the following chapters be run from within the
[ef13657]49chroot environment. If you leave this environment for any reason
50(rebooting for example), remember to first mount the <systemitem
51class="filesystem">proc</systemitem> and <systemitem
52class="filesystem">devpts</systemitem> file systems (discussed in the
53previous section) and enter chroot again before continuing with the
54installations.</para>
55
56<para>Note that the bash prompt will say <quote>I have no
57name!</quote> This is normal because the
58<filename>/etc/passwd</filename> file has not been created yet.</para>
[673b0d8]59
60</sect1>
[ef13657]61
Note: See TracBrowser for help on using the repository browser.