source: chapter06/chroot.xml@ 55e25a9

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 8.2 8.2-rc1 8.3 8.3-rc1 8.3-rc2 8.4 8.4-rc1 9.0 9.0-rc1 9.1 9.1-rc1 cross-chap5 ml-11.0 multilib old-trunk trunk xry111/git-transition xry111/glibc-2.34 xry111/tester-nohack xry111/usr-move
Last change on this file since 55e25a9 was 55e25a9, checked in by Bruce Dubbs <bdubbs@…>, 4 years ago

Update to bash-4.4.12.
Update to meson-0.43.0.
Update to python3-3.6.3.
Update to linux-4.13.7.
Update to binutils-2.29.1.

git-svn-id: 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 3.0 KB
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
8<sect1 id="ch-system-chroot">
9 <?dbhtml filename="chroot.html"?>
11 <title>Entering the Chroot Environment</title>
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>
18<screen role="nodump"><userinput>chroot "$LFS" /tools/bin/env -i \
19 HOME=/root \
20 TERM="$TERM" \
21 PS1='(lfs chroot) \u:\w\$ ' \
22 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
23 /tools/bin/bash --login +h</userinput></screen>
25 <para>The <parameter>-i</parameter> option given to the <command>env</command>
26 command will clear all variables of the chroot environment. After that, only
27 the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
28 <envar>PATH</envar> variables are set again. The
29 <parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
30 variable inside chroot to the same value as outside chroot. This variable is
31 needed for programs like <command>vim</command> and <command>less</command>
32 to operate properly. If other variables are needed, such as
33 <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
34 them again.</para>
36 <para>From this point on, there is no need to use the
37 <envar>LFS</envar> variable anymore, because all work will be restricted
38 to the LFS file system. This is because the Bash shell is told that
39 <filename class="directory">$LFS</filename> is now the root
40 (<filename class="directory">/</filename>) directory.</para>
42 <para>Notice that <filename class="directory">/tools/bin</filename> comes last
43 in the <envar>PATH</envar>. This means that a temporary tool will no longer be
44 used once its final version is installed. This occurs when the shell does not
45 <quote>remember</quote> the locations of executed binaries&mdash;for this
46 reason, hashing is switched off by passing the <parameter>+h</parameter> option
47 to <command>bash</command>.</para>
49 <para>Note that the <command>bash</command> prompt will say
50 <computeroutput>I have no name!</computeroutput> This is normal because the
51 <filename>/etc/passwd</filename> file has not been created yet.</para>
53 <note>
54 <para>It is important that all the commands throughout the remainder of this
55 chapter and the following chapters are run from within the chroot
56 environment. If you leave this environment for any reason (rebooting for
57 example), ensure that the virtual kernel filesystems are mounted as
58 explained in <xref linkend="ch-system-bindmount"/> and <xref
59 linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
60 with the installation.</para>
61 </note>
Note: See TracBrowser for help on using the repository browser.