source: chapter06/chroot.xml@ df8334f

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.0 6.1 6.1.1 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 df8334f was 673b0d8, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • Merged newxml into HEAD

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

  • Property mode set to 100644
File size: 2.6 KB
Line 
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">
7<title>Entering the chroot environment</title>
8<?dbhtml filename="chroot.html"?>
9
10<para>It is time to enter the chroot environment in order to begin building
11and installing your final LFS system. Still as <emphasis>root</emphasis> run
12the following command to enter the small world that is, at the moment,
13populated with only the temporary tools:</para>
14
15<screen><userinput>chroot "$LFS" /tools/bin/env -i \
16 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
17 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
18 /tools/bin/bash --login +h</userinput></screen>
19
20<para>The <emphasis>-i</emphasis> option given to the
21<command>env</command> command will clear all variables of the chroot
22environment. After that, only the HOME, TERM, PS1 and PATH variables are
23set again. The TERM=$TERM construct will set the TERM variable inside chroot
24to the same value as outside chroot; this variable is needed for programs
25like <command>vim</command> and <command>less</command> to operate
26properly. If you need other variables present, such as CFLAGS or CXXFLAGS,
27this is a good place to set them again.</para>
28
29<para>From this point on there's no need to use the LFS variable anymore,
30because everything you do will be restricted to the LFS file system -- since
31what the shell thinks is <filename class="directory">/</filename> is actually
32the value of <filename class="directory">$LFS</filename>, which was passed to
33the chroot command.</para>
34
35<para>Notice that <filename class="directory">/tools/bin</filename> comes
36last in the PATH. This means that a temporary tool will not be used any more
37as soon as its final version is installed. Well, at least when the shell
38doesn't remember the locations of executed binaries -- for this reason hashing
39is switched off by passing the <emphasis>+h</emphasis> option to
40<command>bash</command>.</para>
41
42<para>You have to make sure all the commands in the rest of this chapter and
43in the following chapters are run from within the chroot environment.
44If you ever leave this environment for any reason (rebooting for example),
45you must remember to first mount the proc and devpts file systems (discussed
46in the previous section) <emphasis>and</emphasis> enter chroot again before
47continuing with the installations.</para>
48
49<para>Note that the bash prompt will say <quote>I have no name!</quote> This is
50normal, as the <filename>/etc/passwd</filename> file has not been created yet.
51</para>
52
53</sect1>
Note: See TracBrowser for help on using the repository browser.