Changeset cba2d4e for chapter07/introduction.xml
- Timestamp:
- 04/03/2014 09:52:09 PM (10 years ago)
- Branches:
- 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, 7.6, 7.7, 7.8, 7.9, 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
- Children:
- 9839808
- Parents:
- 008436e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/introduction.xml
r008436e rcba2d4e 11 11 <title>Introduction</title> 12 12 13 <para>This chapter discusses configuration files and boot scripts. 14 First, the general configuration files needed to set up networking are 15 presented.</para> 16 17 <itemizedlist> 18 <listitem> 19 <para><xref linkend="ch-scripts-network" role="."/></para> 20 </listitem> 21 <listitem> 22 <para><xref linkend="ch-scripts-hosts" role="."/></para> 23 </listitem> 24 </itemizedlist> 25 26 <para>Second, issues that affect the proper setup of devices are 27 discussed.</para> 28 29 <itemizedlist> 30 <listitem> 31 <para><xref linkend="ch-scripts-udev" role="."/></para> 32 </listitem> 33 <listitem> 34 <para><xref linkend="ch-scripts-symlinks" role="."/></para> 35 </listitem> 36 </itemizedlist> 37 38 <para>The next sections detail how to install and configure the LFS system 39 scripts needed during the boot process. Most of these scripts will work 40 without modification, but a few require additional configuration files 41 because they deal with hardware-dependent information.</para> 42 43 <para>System-V style init scripts are employed in this book because they are 44 widely used and relatively simple. For additional options, a hint detailing 45 the BSD style init setup is available at <ulink 46 url="&hints-root;bsd-init.txt"/>. Searching the LFS mailing lists for 47 <quote>depinit</quote>, <quote>upstart</quote>, or <quote>systemd</quote> 48 will also offer additional information.</para> 49 50 <para>If using an alternative style of init scripts, skip these sections.</para> 51 52 <para>A listing of the boot scripts are found in <xref linkend="scripts" 53 role="."/>.</para> 54 55 56 <itemizedlist> 57 <listitem> 58 <para><xref linkend="ch-scripts-bootscripts" role="."/></para> 59 </listitem> 60 <listitem> 61 <para><xref linkend="ch-scripts-usage" role="."/></para> 62 </listitem> 63 <listitem> 64 <para><xref linkend="ch-scripts-hostname" role="."/></para> 65 </listitem> 66 <listitem> 67 <para><xref linkend="ch-scripts-setclock" role="."/></para> 68 </listitem> 69 <listitem> 70 <para><xref linkend="ch-scripts-console" role="."/></para> 71 </listitem> 72 <listitem> 73 <para><xref linkend="ch-scripts-sysklogd" role="."/></para> 74 </listitem> 75 </itemizedlist> 76 77 78 <para>Finally, there is a brief introduction to the scripts and configuration 79 files used when the user logs into the system.</para> 80 81 <itemizedlist> 82 <listitem> 83 <para><xref linkend="ch-scripts-profile" role="."/></para> 84 </listitem> 85 <listitem> 86 <para><xref linkend="ch-scripts-inputrc" role="."/></para> 87 </listitem> 88 </itemizedlist> 89 13 <para>Booting a Linux system involves several tasks. The process must 14 mount both virtual and real file systems, initialize devices, activate swap, 15 check file systems for integrity, mount any swap partitions or files, set 16 the system clock, bring up networking, start any daemons required by the 17 system, and accomplish any other custom tasks needed by the user. This 18 process must be organized to ensure the tasks are performed in the correct 19 order but, at the same time, be executed as fast as possible.</para> 20 21 <para>In the packages that were installed in Chapter 6, there were two 22 different boot systems installed. LFS provides the ability to easily 23 select which system the user wants to use and to compare and contrast the 24 two systems by actually running each system on the local computer. The 25 advantages and disadvantages of these systems is presented below.</para> 26 27 <sect2 id='sysv-desc'> 28 <title>System V</title> 29 30 <para>System V is the classic boot process that has been used in Unix and 31 Unix-like systems such as Linux since about 1983. It consists of a small 32 program, <command>init</command>, that sets up basic programs such as 33 <command>login</command> (via getty) and runs a script. This script, 34 usually named <command>rc</command>, controls the execution of a set of 35 additional scripts that perform the tasks required to initialize the 36 system.</para> 37 38 <para>The <command>init</command> program is controlled by the 39 <filename>/etc/inittab</filename> file and is organized into run levels that 40 can be run by the user:</para> 41 42 <itemizedlist> 43 <listitem><para>0 — halt</para></listitem> 44 <listitem><para>1 — Single user mode</para></listitem> 45 <listitem><para>2 — Multiuser, without networking</para></listitem> 46 <listitem><para>3 — Full multiuser mode</para></listitem> 47 <listitem><para>4 — User definable</para></listitem> 48 <listitem><para>5 — Full multiuser mode with display manager</para></listitem> 49 <listitem><para>6 — reboot</para></listitem> 50 </itemizedlist> 51 52 <para>The usual default run level is 3 or 5.</para> 53 54 <bridgehead renderas="sect3">Advantages</bridgehead> 55 56 <itemizedlist> 57 <listitem> 58 <para>Established, well understood system.</para> 59 </listitem> 60 61 <listitem> 62 <para>Easy to customize.</para> 63 </listitem> 64 65 </itemizedlist> 66 67 68 <bridgehead renderas="sect3">Disadvantages</bridgehead> 69 70 <itemizedlist> 71 <listitem> 72 <para>Slower to boot. A medium speed base LFS system 73 takes 8-12 seconds where the boot time is measured from the 74 first kernel message to the login prompt. Network 75 connectivity is typically established about 2 seconds 76 after the login prompt.</para> 77 </listitem> 78 79 <listitem> 80 <para>Serial processing of boot tasks. This is related to the previous 81 point. A delay in any process such as a file system check, will 82 delay the entire boot process.</para> 83 </listitem> 84 85 <listitem> 86 <para>Does not directly support advanced features like 87 control groups (cgroups), and per-user fair share scheduling.</para> 88 </listitem> 89 90 <listitem> 91 <para>Adding scripts requires manual, static sequencing decisions.</para> 92 </listitem> 93 94 </itemizedlist> 95 96 </sect2> 97 98 <sect2 id='sysd-desc'> 99 <title>Systemd</title> 100 101 <para>Systemd is a group of interconnected programs that handles system and 102 individual process requests. It provides a dependency system between 103 various entities called "units". It automatically addresses dependencies 104 between units and can execute several startup tasks in parallel. It 105 provides login, inetd, logging, time, and networking services. </para> 106 107 <bridgehead renderas="sect3">Advantages</bridgehead> 108 109 <itemizedlist> 110 <listitem> 111 <para>Used on many established distributions by default.</para> 112 </listitem> 113 114 <listitem> 115 <para>There is extensive documentation. 116 See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para> 117 </listitem> 118 119 <listitem> 120 <para>Parallel execution of boot processes. A medium speed 121 base LFS system takes 6-10 seconds from kernel start to a 122 login prompt. Network connectivity is typically established 123 about 2 seconds after the login prompt. More complex startup 124 procedures may show a greater speedup when compared to System V.</para> 125 </listitem> 126 127 <listitem> 128 <para>Implements advanced features such as control groups to 129 manage related processes.</para> 130 </listitem> 131 132 <listitem> 133 <para>Maintains backward compatibility with System V programs 134 and scripts.</para> 135 </listitem> 136 </itemizedlist> 137 138 <bridgehead renderas="sect3">Disadvantages</bridgehead> 139 140 <itemizedlist> 141 <listitem> 142 <para>There is a substantial learning curve.</para> 143 </listitem> 144 145 <listitem> 146 <para>Some advanced features such as dbus or cgroups cannot be 147 disabled if they are not otherwise needed.</para> 148 </listitem> 149 150 <listitem> 151 <para>Although implemented as several executable programs 152 the user cannot choose to implement only the portions desired.</para> 153 </listitem> 154 155 <listitem> 156 <para>Due to the nature of using compiled programs, systemd is 157 more difficult to debug.</para> 158 </listitem> 159 160 <listitem> 161 <para>Logging is done in a binary format. Extra tools must 162 be used to process logs or additional processes must be implemented 163 to duplicate traditional logging programs.</para> 164 </listitem> 165 166 </itemizedlist> 167 168 </sect2> 169 170 <sect2 id='sysv'> 171 <title>Selecting a Boot Method</title> 172 173 <para>Selecting a boot method in LFS is relatively easy. 174 Both systems are installed side-by-side. The only task needed is to 175 ensure the files that are needed by the system have the correct names. 176 The following scripts do that.</para> 177 178 <screen><userinput remap="install">cat > /usr/local/sbin/set-systemd << "EOF" 179 #! /bin/bash 180 181 ln -svfn init-systemd /sbin/init 182 ln -svfn init.d-systemd /etc/init.d 183 184 for tool in halt poweroff reboot runlevel shutdown telinit; do 185 ln -sfvn $(tool}-systemd /sbin/${tool} 186 ln -svfn ${tool}-systemd.8 /usr/share/man/man8/${tool}.8 187 done 188 189 echo "Now reboot with /sbin/reboot-sysv" 190 EOF 191 192 chmod 0744 /usr/local/sbin/set-systemd 193 194 cat > /usr/local/sbin/set-sysv << "EOF" 195 ln -sfvn init-sysv /sbin/init 196 ln -svfn init.d-sysv /etc/init.d 197 198 for tool in halt poweroff reboot runlevel shutdown telinit; do 199 ln -sfvn ${tool}-sysv /sbin/${tool} 200 ln -svfn ${tool}-sysv.8 /usr/share/man/man8/${tool}.8 201 done 202 203 echo "Now reboot with /sbin/reboot-systemd" 204 EOF 205 206 chmod 0744 /usr/local/sbin/set-sysv</userinput></screen> 207 208 <para>Now set the desired boot system. The default is System V:</para> 209 210 <screen><userinput remap="install">/usr/local/sbin/set-sysv</userinput></screen> 211 212 <para>Changing the boot system can be done at any time by running the 213 appropriate script above and rebooting.</para> 214 215 </sect2> 90 216 91 217 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.