introduction.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. <sect1 id="ch-config-introduction" revision="sysv">
  8. <?dbhtml filename="introduction.html"?>
  9. <title>Introduction</title>
  10. <para>Booting a Linux system involves several tasks. The process must
  11. mount both virtual and real file systems, initialize devices, activate swap,
  12. check file systems for integrity, mount any swap partitions or files, set
  13. the system clock, bring up networking, start any daemons required by the
  14. system, and accomplish any other custom tasks needed by the user. This
  15. process must be organized to ensure the tasks are performed in the correct
  16. order but, at the same time, be executed as fast as possible.</para>
  17. <!-- <para>In the packages that were installed in Chapter&nbsp;6, there were two
  18. different boot systems installed. LFS provides the ability to easily
  19. select which system the user wants to use and to compare and contrast the
  20. two systems by actually running each system on the local computer. The
  21. advantages and disadvantages of these systems is presented below.</para>-->
  22. <sect2 id='sysv-desc'>
  23. <title>System V</title>
  24. <para>System V is the classic boot process that has been used in Unix and
  25. Unix-like systems such as Linux since about 1983. It consists of a small
  26. program, <command>init</command>, that sets up basic programs such as
  27. <command>login</command> (via getty) and runs a script. This script,
  28. usually named <command>rc</command>, controls the execution of a set of
  29. additional scripts that perform the tasks required to initialize the
  30. system.</para>
  31. <para>The <command>init</command> program is controlled by the
  32. <filename>/etc/inittab</filename> file and is organized into run levels that
  33. can be run by the user:</para>
  34. <literallayout>
  35. 0 &mdash; halt
  36. 1 &mdash; Single user mode
  37. 2 &mdash; Multiuser, without networking
  38. 3 &mdash; Full multiuser mode
  39. 4 &mdash; User definable
  40. 5 &mdash; Full multiuser mode with display manager
  41. 6 &mdash; reboot
  42. </literallayout>
  43. <para>The usual default run level is 3 or 5.</para>
  44. <bridgehead renderas="sect3">Advantages</bridgehead>
  45. <itemizedlist>
  46. <listitem>
  47. <para>Established, well understood system.</para>
  48. </listitem>
  49. <listitem>
  50. <para>Easy to customize.</para>
  51. </listitem>
  52. </itemizedlist>
  53. <bridgehead renderas="sect3">Disadvantages</bridgehead>
  54. <itemizedlist>
  55. <listitem>
  56. <para>Slower to boot. A medium speed base LFS system
  57. takes 8-12 seconds where the boot time is measured from the
  58. first kernel message to the login prompt. Network
  59. connectivity is typically established about 2 seconds
  60. after the login prompt.</para>
  61. </listitem>
  62. <listitem>
  63. <para>Serial processing of boot tasks. This is related to the previous
  64. point. A delay in any process such as a file system check, will
  65. delay the entire boot process.</para>
  66. </listitem>
  67. <listitem>
  68. <para>Does not directly support advanced features like
  69. control groups (cgroups), and per-user fair share scheduling.</para>
  70. </listitem>
  71. <listitem>
  72. <para>Adding scripts requires manual, static sequencing decisions.</para>
  73. </listitem>
  74. </itemizedlist>
  75. </sect2>
  76. <!--
  77. <sect2 id='sysd-desc'>
  78. <title>Systemd</title>
  79. <para>Systemd is a group of interconnected programs that handles system and
  80. individual process requests. It provides a dependency system between
  81. various entities called "units". It automatically addresses dependencies
  82. between units and can execute several startup tasks in parallel. It
  83. provides login, inetd, logging, time, and networking services. </para>
  84. <bridgehead renderas="sect3">Advantages</bridgehead>
  85. <itemizedlist>
  86. <listitem>
  87. <para>Used on many established distributions by default.</para>
  88. </listitem>
  89. <listitem>
  90. <para>There is extensive documentation.
  91. See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>
  92. </listitem>
  93. <listitem>
  94. <para>Parallel execution of boot processes. A medium speed
  95. base LFS system takes 6-10 seconds from kernel start to a
  96. login prompt. Network connectivity is typically established
  97. about 2 seconds after the login prompt. More complex startup
  98. procedures may show a greater speedup when compared to System V.</para>
  99. </listitem>
  100. <listitem>
  101. <para>Implements advanced features such as control groups to
  102. manage related processes.</para>
  103. </listitem>
  104. <listitem>
  105. <para>Maintains backward compatibility with System V programs
  106. and scripts.</para>
  107. </listitem>
  108. </itemizedlist>
  109. <bridgehead renderas="sect3">Disadvantages</bridgehead>
  110. <itemizedlist>
  111. <listitem>
  112. <para>There is a substantial learning curve.</para>
  113. </listitem>
  114. <listitem>
  115. <para>Some advanced features such as dbus or cgroups cannot be
  116. disabled if they are not otherwise needed.</para>
  117. </listitem>
  118. <listitem>
  119. <para>Although implemented as several executable programs
  120. the user cannot choose to implement only the portions desired.</para>
  121. </listitem>
  122. <listitem>
  123. <para>Due to the nature of using compiled programs, systemd is
  124. more difficult to debug.</para>
  125. </listitem>
  126. <listitem>
  127. <para>Logging is done in a binary format. Extra tools must
  128. be used to process logs or additional processes must be implemented
  129. to duplicate traditional logging programs.</para>
  130. </listitem>
  131. </itemizedlist>
  132. </sect2>
  133. -->
  134. <!--
  135. <sect2 id='sysv'>
  136. <title>Selecting a Boot Method</title>
  137. <para>Selecting a boot method in LFS is relatively easy.
  138. Both systems are installed side-by-side. The only task needed is to
  139. ensure the files that are needed by the system have the correct names.
  140. The following scripts do that.</para>
  141. <screen><userinput remap="install">cat &gt; /usr/sbin/set-systemd &lt;&lt; "EOF"
  142. #! /bin/bash
  143. ln -svfn init-systemd /sbin/init
  144. ln -svfn init.d-systemd /etc/init.d
  145. for tool in halt poweroff reboot runlevel shutdown telinit; do
  146. ln -sfvn ${tool}-systemd /sbin/${tool}
  147. ln -svfn ${tool}-systemd.8 /usr/share/man/man8/${tool}.8
  148. done
  149. echo "Now reboot with /sbin/reboot-sysv"
  150. EOF
  151. chmod 0744 /usr/sbin/set-systemd
  152. cat &gt; /usr/sbin/set-sysv &lt;&lt; "EOF"
  153. #! /bin/bash
  154. ln -sfvn init-sysv /sbin/init
  155. ln -svfn init.d-sysv /etc/init.d
  156. for tool in halt poweroff reboot runlevel shutdown telinit; do
  157. ln -sfvn ${tool}-sysv /sbin/${tool}
  158. ln -svfn ${tool}-sysv.8 /usr/share/man/man8/${tool}.8
  159. done
  160. echo "Now reboot with /sbin/reboot-systemd"
  161. EOF
  162. chmod 0744 /usr/sbin/set-sysv</userinput></screen>
  163. <note><para>The comment about the correct command to reboot in the
  164. above scripts is correct. The reboot command for the current boot
  165. system must be used after the script changes the default reboot command.
  166. </para></note>
  167. <para>Now set the desired boot system. The default is System V:</para>
  168. <screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>
  169. <para>Changing the boot system can be done at any time by running the
  170. appropriate script above and rebooting.</para>
  171. </sect2>
  172. -->
  173. </sect1>