source: chapter07/chroot.xml@ 387a32af

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 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 387a32af was 387a32af, checked in by Bruce Dubbs <bdubbs@…>, 4 years ago

Update initial Chapter 7 pages for cross2 branch

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

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