diff options
author | Archaic <archaic@linuxfromscratch.org> | 2006-04-02 15:09:47 +0000 |
---|---|---|
committer | Archaic <archaic@linuxfromscratch.org> | 2006-04-02 15:09:47 +0000 |
commit | 0976a9a5bcb0d6e4a02baafb02141b3a1a714699 (patch) | |
tree | e0b768c2e91e1885663cecef574e19a814c26d19 | |
parent | 0b528e487fcd00020db891689420456487e738e4 (diff) |
- Moved the chowning of /tools to the end of chapter 5 and rewrote note about
backing up or re-using /tools.
- Moved the mounting of kernel filesystems before pkgmgt page and rewrote the
page to mount --bind /dev and mount all other kernel filesystems while
outside chroot.
- Rewrote note about re-entering chroot and remounting kernel filesystems.
- Removed /dev from the list of dirs created in chroot and added it before
chroot.
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/udev_update/BOOK@7486 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r-- | chapter01/changelog.xml | 15 | ||||
-rw-r--r-- | chapter05/changingowner.xml | 46 | ||||
-rw-r--r-- | chapter05/chapter05.xml | 1 | ||||
-rw-r--r-- | chapter06/changingowner.xml | 40 | ||||
-rw-r--r-- | chapter06/chapter06.xml | 4 | ||||
-rw-r--r-- | chapter06/chroot.xml | 18 | ||||
-rw-r--r-- | chapter06/creatingdirs.xml | 2 | ||||
-rw-r--r-- | chapter06/devices.xml | 93 | ||||
-rw-r--r-- | chapter06/introduction.xml | 7 | ||||
-rw-r--r-- | chapter06/kernfs.xml | 79 | ||||
-rw-r--r-- | chapter06/pkgmgt.xml | 8 | ||||
-rw-r--r-- | general.ent | 4 |
12 files changed, 135 insertions, 182 deletions
diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 542391c57..b8074b50f 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -37,6 +37,21 @@ --> <listitem> + <para>April 2, 2006</para> + <itemizedlist> + <listitem> + <para>[archaic] - Moved the chowning of /tools to the end of chapter 5 + and rewrote note about backing up or re-using /tools. Moved the + mounting of kernel filesystems before pkgmgt page and rewrote the page + to mount --bind /dev and mount all other kernel filesystems while + outside chroot. Rewrote note about re-entering chroot and remounting + kernel filesystems. Removed /dev from the list of dirs created in + chroot and added it before chroot.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> <para>March 30, 2006</para> <itemizedlist> <listitem> diff --git a/chapter05/changingowner.xml b/chapter05/changingowner.xml new file mode 100644 index 000000000..b80ebb1b4 --- /dev/null +++ b/chapter05/changingowner.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" + "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-changingowner"> + <?dbhtml filename="changingowner.html"?> + + <title>Changing Ownership</title> + + <note> + <para>The commands in the remainder of this book must be performed while + logged in as user <systemitem class="username">root</systemitem> and no + longer as user <systemitem class="username">lfs</systemitem>. Also, double + check that <envar>$LFS</envar> is set in <systemitem + class="username">root</systemitem>'s environment.</para> + </note> + + <para>Currently, the <filename class="directory">/tools</filename> directory + is owned by the user <systemitem class="username">lfs</systemitem>, a user + that exists only on the host system. If the <filename + class="directory">/tools</filename> directory is kept as is, the files are + owned by a user ID without a corresponding account. This is dangerous because + a user account created later could get this same user ID and would own the + <filename class="directory">/tools</filename> directory and all the files + therein, thus exposing these files to possible malicious manipulation.</para> + + <para>To avoid this issue, you could add the <systemitem + class="username">lfs</systemitem> user to the new LFS system later when + creating the <filename>/etc/passwd</filename> file, taking care to assign it + the same user and group IDs as on the host system. Better yet, change the + ownership of the <filename class="directory">/tools</filename> directory to + user <systemitem class="username">root</systemitem> by running the following + command:</para> + +<screen><userinput>chown -R root:root /tools</userinput></screen> + + <para>Although the <filename class="directory">/tools</filename> directory can + be deleted once the LFS system has been finished, it can be retained to build + additional LFS systems <emphasis>of the same book version</emphasis>. How best + to backup <filename class="directory">/tools</filename> is a matter of + personal preference and is left as an exercise for the reader.</para> + +</sect1> diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index 45d2081b4..96336d0b8 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -44,5 +44,6 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="util-linux.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="perl.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="stripping.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="changingowner.xml"/> </chapter> diff --git a/chapter06/changingowner.xml b/chapter06/changingowner.xml deleted file mode 100644 index 83deca414..000000000 --- a/chapter06/changingowner.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" - "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-changingowner"> - <?dbhtml filename="changingowner.html"?> - - <title>Changing Ownership</title> - - <para>Currently, the <filename class="directory">/tools</filename> directory - is owned by the user <systemitem class="username">lfs</systemitem>, a user - that exists only on the host system. Although the <filename - class="directory">/tools</filename> directory can be deleted once the LFS - system has been finished, it can be retained to build additional LFS systems. - If the <filename class="directory">/tools</filename> directory is kept as is, - the files are owned by a user ID without a corresponding account. This is - dangerous because a user account created later could get this same user ID - and would own the <filename class="directory">/tools</filename> directory - and all the files therein, thus exposing these files to possible malicious - manipulation.</para> - - <para>To avoid this issue, add the <systemitem class="username">lfs</systemitem> - user to the new LFS system later when creating the - <filename>/etc/passwd</filename> file, taking care to assign it the same user - and group IDs as on the host system. Alternatively, assign the contents of - the <filename class="directory">/tools</filename> directory to user - <systemitem class="username">root</systemitem> by running the following - command:</para> - -<screen><userinput>chown -R 0:0 /tools</userinput></screen> - - <para>The command uses <parameter>0:0</parameter> instead of - <parameter>root:root</parameter>, because <command>chown</command> - is unable to resolve the name <quote>root</quote> until the - <filename>passwd</filename> file has been created.</para> - -</sect1> diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index 77c43f64c..75e9ba2c7 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -12,14 +12,12 @@ <title>Installing Basic System Software</title> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="introduction.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pkgmgt.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernfs.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pkgmgt.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="chroot.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="changingowner.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creatingdirs.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="createfiles.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pwdgroup.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="devices.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="linux-libc-headers.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="man-pages.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="glibc.xml"/> diff --git a/chapter06/chroot.xml b/chapter06/chroot.xml index ca3e86a92..ea213033e 100644 --- a/chapter06/chroot.xml +++ b/chapter06/chroot.xml @@ -44,16 +44,18 @@ reason, hashing is switched off by passing the <parameter>+h</parameter> option to <command>bash</command>.</para> - <para>It is important that all the commands throughout the remainder of this - chapter and the following chapters are run from within the chroot environment. - If you leave this environment for any reason (rebooting for example), remember - to first mount the <systemitem class="filesystem">proc</systemitem> and - <systemitem class="filesystem">devpts</systemitem> file systems (discussed - in the previous section) and enter chroot again before continuing with the - installations.</para> - <para>Note that the <command>bash</command> prompt will say <computeroutput>I have no name!</computeroutput> This is normal because the <filename>/etc/passwd</filename> file has not been created yet.</para> + <note> + <para>It is important that all the commands throughout the remainder of this + chapter and the following chapters are run from within the chroot + environment. If you leave this environment for any reason (rebooting for + example), ensure that the virtual kernel filesystems are mounted as + explained in <xref linkend="ch-system-bindmount"/> and <xref + linkend="ch-system-kernfsmount"/> and enter chroot again before continuing + with the installation.</para> + </note> + </sect1> diff --git a/chapter06/creatingdirs.xml b/chapter06/creatingdirs.xml index b9a269ebc..4e602b356 100644 --- a/chapter06/creatingdirs.xml +++ b/chapter06/creatingdirs.xml @@ -13,7 +13,7 @@ <para>It is time to create some structure in the LFS file system. Create a standard directory tree by issuing the following commands:</para> -<screen><userinput>install -dv /{bin,boot,dev,etc/opt,home,lib,mnt} +<screen><userinput>install -dv /{bin,boot,etc/opt,home,lib,mnt} install -dv /{sbin,srv,usr/local,var,opt} install -dv /root -m 0750 install -dv /tmp /var/tmp -m 1777 diff --git a/chapter06/devices.xml b/chapter06/devices.xml deleted file mode 100644 index 51821fe84..000000000 --- a/chapter06/devices.xml +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" - "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-devices"> - <?dbhtml filename="devices.html"?> - - <title>Populating /dev</title> - - <indexterm zone="ch-system-devices"> - <primary sortas="e-/dev/">/dev/*</primary> - </indexterm> - - <sect2> - <title>Creating Initial Device Nodes</title> - - <para>When the kernel boots the system, it requires the presence of a few - device nodes, in particular the <filename class="devicefile">console</filename> - and <filename class="devicefile">null</filename> devices. The device nodes - will be created on the hard disk so that they are available before - <command>udev</command> has been started, and additionally when Linux is - started in single user mode (hence the restrictive permissions on - <filename class="devicefile">console</filename>). Create the devices by - running the following commands:</para> - -<screen><userinput>mknod -m 600 /dev/console c 5 1 -mknod -m 666 /dev/null c 1 3</userinput></screen> - - </sect2> - - <sect2> - <title>Mounting tmpfs and Populating /dev</title> - - <para>The recommended method of populating the <filename - class="directory">/dev</filename> directory with devices is to mount a - virtual filesystem (such as <systemitem class="filesystem">tmpfs</systemitem>) - on the <filename class="directory">/dev</filename> directory, and allow the - devices to be created dynamically on that virtual filesystem as they are - detected or accessed. This is generally done during the boot process. Since - this new system has not been booted, it is necessary to do what the - LFS-Bootscripts package would otherwise do by mounting <filename - class="directory">/dev</filename>:</para> - -<screen><userinput>mount -nvt tmpfs none /dev</userinput></screen> - - <para>The Udev package is what actually creates the devices in the <filename - class="directory">/dev</filename> directory. Since it will not be installed - until later on in the process, manually create the minimal set of device nodes - needed to complete the building of this system:</para> - -<screen><userinput>mknod -m 622 /dev/console c 5 1 -mknod -m 666 /dev/null c 1 3 -mknod -m 666 /dev/zero c 1 5 -mknod -m 666 /dev/ptmx c 5 2 -mknod -m 666 /dev/tty c 5 0 -mknod -m 444 /dev/random c 1 8 -mknod -m 444 /dev/urandom c 1 9 -chown -v root:tty /dev/{console,ptmx,tty}</userinput></screen> - - <para>There are some symlinks and directories required by LFS that are - created during system startup by the LFS-Bootscripts package. Since this - is a chroot environment and not a booted environment, those symlinks and - directories need to be created here:</para> - -<screen><userinput>ln -sv /proc/self/fd /dev/fd -ln -sv /proc/self/fd/0 /dev/stdin -ln -sv /proc/self/fd/1 /dev/stdout -ln -sv /proc/self/fd/2 /dev/stderr -ln -sv /proc/kcore /dev/core -mkdir -v /dev/pts -mkdir -v /dev/shm</userinput></screen> - - <para>Finally, mount the proper virtual (kernel) file systems on the - newly-created directories:</para> - -<screen><userinput>mount -vt devpts -o gid=4,mode=620 none /dev/pts -mount -vt tmpfs none /dev/shm</userinput></screen> - - <para>The <command>mount</command> commands executed above may result - in the following warning message:</para> - -<screen><computeroutput>can't open /etc/fstab: No such file or directory.</computeroutput></screen> - - <para>This file—<filename>/etc/fstab</filename>—has not - been created yet but is also not required for the file systems to be - properly mounted. As such, the warning can be safely ignored.</para> - - </sect2> - -</sect1> diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index 5e9cfd5c3..588d84780 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -55,11 +55,4 @@ there is a list of programs and libraries (along with brief descriptions of these) that the package installs.</para> - <note> - <para>At this point, you may wish to keep your finished temporary - tools for use in future LFS builds by creating a tarball of the - <filename class="directory">/tools</filename> directory and - storing it in a safe location.</para> - </note> - </sect1> diff --git a/chapter06/kernfs.xml b/chapter06/kernfs.xml index 2bdf9f9c3..3c9e68c0b 100644 --- a/chapter06/kernfs.xml +++ b/chapter06/kernfs.xml @@ -8,33 +8,72 @@ <sect1 id="ch-system-kernfs"> <?dbhtml filename="kernfs.html"?> - <title>Mounting Virtual Kernel File Systems</title> + <title>Preparing Virtual Kernel File Systems</title> - <para>Various file systems exported by the kernel are used to communicate to and - from the kernel itself. These file systems are virtual in that no disk space is - used for them. The content of the file systems resides in memory.</para> + <indexterm zone="ch-system-kernfs"> + <primary sortas="e-/dev/">/dev/*</primary> + </indexterm> - <para>Begin by creating directories onto which the file systems will be - mounted:</para> + <para>Various file systems exported by the kernel are used to communicate to + and from the kernel itself. These file systems are virtual in that no disk + space is used for them. The content of the file systems resides in + memory.</para> -<screen><userinput>mkdir -pv $LFS/{proc,sys}</userinput></screen> + <para>Begin by creating directories onto which the file systems will be + mounted:</para> - <para>Now mount the file systems:</para> +<screen><userinput>mkdir -pv $LFS/{dev,proc,sys}</userinput></screen> -<screen><userinput>mount -vt proc proc $LFS/proc -mount -vt sysfs sysfs $LFS/sys</userinput></screen> + <sect2> + <title>Creating Initial Device Nodes</title> + + <para>When the kernel boots the system, it requires the presence of a few + device nodes, in particular the <filename + class="devicefile">console</filename> and <filename + class="devicefile">null</filename> devices. The device nodes will be created + on the hard disk so that they are available before <command>udev</command> + has been started, and additionally when Linux is started in single user mode + (hence the restrictive permissions on <filename + class="devicefile">console</filename>). Create the devices by running the + following commands:</para> + +<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1 +mknod -m 666 $LFS/dev/null c 1 3</userinput></screen> + + </sect2> + + <sect2 id="ch-system-bindmount"> + <title>Mounting and Populating /dev</title> - <para>Remember that if for any reason you stop working on the LFS - system and start again later, it is important to check that these file - systems are mounted again before entering the chroot - environment.</para> + <para>The recommended method of populating the <filename + class="directory">/dev</filename> directory with devices is to mount a + virtual filesystem (such as <systemitem + class="filesystem">tmpfs</systemitem>) on the <filename + class="directory">/dev</filename> directory, and allow the devices to be + created dynamically on that virtual filesystem as they are detected or + accessed. This is generally done during the boot process by Udev. Since + this new system does not yet have Udev and has not yet been booted, it is + necessary to mount and populate <filename + class="directory">/dev</filename> manually. This is accomplished by bind + mounting the host system's <filename class="directory">/dev</filename> + directory. A bind mount is a special type of mount that allows you to + create a mirror of a directory or mount point to some other location. Use + the following command to achieve this:</para> - <para>Additional file systems will soon be mounted from within the - chroot environment. To keep the host up to date, perform a <quote>fake - mount</quote> for each of these now:</para> +<screen><userinput>mount --bind /dev $LFS/dev</userinput></screen> + + </sect2> + + <sect2 id="ch-system-kernfsmount"> + <title>Mounting Virtual Kernel File Systems</title> + + <para>Now mount the remaining virtual kernel filesystems:</para> + +<screen><userinput>mount -vt devpts devpts $LFS/dev/pts +mount -vt tmpfs shm $LFS/dev/shm +mount -vt proc proc $LFS/proc +mount -vt sysfs sysfs $LFS/sys</userinput></screen> -<screen><userinput>mount -vft tmpfs tmpfs $LFS/dev -mount -vft tmpfs tmpfs $LFS/dev/shm -mount -vft devpts -o gid=4,mode=620 devpts $LFS/dev/pts</userinput></screen> + </sect2> </sect1> diff --git a/chapter06/pkgmgt.xml b/chapter06/pkgmgt.xml index 76ea123e2..4ce94106d 100644 --- a/chapter06/pkgmgt.xml +++ b/chapter06/pkgmgt.xml @@ -39,14 +39,6 @@ the <ulink url="&hints-root;">Hints subproject</ulink> and see if one of them fits your need.</para> - <note> - <para>As no particular package management technique is mentioned in LFS, - the commands in the remainder of this book must be performed while logged in - as user <systemitem class="username">root</systemitem> and no longer as user - <systemitem class="username">lfs</systemitem>. Also, double check that - <envar>$LFS</envar> is set.</para> - </note> - <sect2> <title>Upgrade Issues</title> diff --git a/general.ent b/general.ent index ae15a999e..d6195e051 100644 --- a/general.ent +++ b/general.ent @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<!ENTITY version "udev_update-20060330"> -<!ENTITY releasedate "March 30, 2006"> +<!ENTITY version "udev_update-20060402"> +<!ENTITY releasedate "April 2, 2006"> <!ENTITY milestone "6.2"> <!ENTITY generic-version "udev_update"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> |