source: chapter07/chroot.xml@ fcc02767

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 ml-11.0 multilib trunk xry111/git-transition xry111/glibc-2.34 xry111/tester-nohack xry111/usr-move
Last change on this file since fcc02767 was fcc02767, checked in by Bruce Dubbs <bdubbs@…>, 18 months ago

Initial commit of alternative cross LFS

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

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