source: chapter06/chroot.xml@ dd7ed7b

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since dd7ed7b was 8ef8304, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Indenting chapter 6, part 3

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

  • Property mode set to 100644
File size: 2.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-system-chroot">
9 <?dbhtml filename="chroot.html"?>
10
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>
17
18<screen><userinput>chroot "$LFS" /tools/bin/env -i \
19 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
20 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
21 /tools/bin/bash --login +h</userinput></screen>
22
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
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
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&mdash;for this
44 reason, hashing is switched off by passing the <parameter>+h</parameter> option
45 to <command>bash</command>.</para>
46
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>
54
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>
58
59</sect1>
Note: See TracBrowser for help on using the repository browser.