source: chapter06/sysvinit.xml@ 8ad7980

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 8ad7980 was 8ad7980, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Tags corrections

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

  • Property mode set to 100644
File size: 9.2 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-sysvinit" xreflabel="Sysvinit" role="wrap">
7<title>Sysvinit-&sysvinit-version;</title>
8<?dbhtml filename="sysvinit.html"?>
9
10<indexterm zone="ch-system-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary></indexterm>
11
12<sect2 role="package"><title/>
13<para>The Sysvinit package contains programs for controlling the startup,
14running, and shutdown of your system.</para>
15
16<segmentedlist>
17<segtitle>&buildtime;</segtitle>
18<segtitle>&diskspace;</segtitle>
19<seglistitem><seg>0.1 SBU</seg><seg> 0.9 MB</seg></seglistitem>
20</segmentedlist>
21
22<segmentedlist>
23<segtitle>Sysvinit installation depends on</segtitle>
24<seglistitem><seg>Binutils, Coreutils, GCC, Glibc, Make</seg></seglistitem>
25</segmentedlist>
26</sect2>
27
28<sect2 role="installation">
29<title>Installation of Sysvinit</title>
30
31<para>Sysvinit &sysvinit-version; contains a <quote>buffer overflow</quote> bug.
32Under some conditions, it clobbers the
33values of environment variables. Fix that:</para>
34
35<screen><userinput>patch -Np1 -i ../sysvinit-&sysvinit-version;-proclen-1.patch</userinput></screen>
36
37<para>When run-levels are changed (for example, when halting the system),
38<command>init</command> sends termination signals to those processes that
39<command>init</command> itself started and that shouldn't be running in the new
40run-level. While doing this, <command>init</command> outputs messages like
41<quote>Sending processes the TERM signal</quote> which seem to imply that it is sending these signals to all currently running processes. To avoid this
42misinterpretation, you can modify the source so that these messages read like
43<quote>Sending processes started by init the TERM signal</quote> instead:</para>
44
45<screen><userinput>sed -i 's@Sending processes@&amp; started by init@g' \
46 src/init.c</userinput></screen>
47
48<para>Compile Sysvinit:</para>
49
50<screen><userinput>make -C src</userinput></screen>
51
52<para>Then install it:</para>
53
54<screen><userinput>make -C src install</userinput></screen>
55
56</sect2>
57
58
59<sect2 id="conf-sysvinit" role="configuration"><title>Configuring Sysvinit</title>
60<indexterm zone="conf-sysvinit">
61<primary sortas="a-Sysvinit">Sysvinit</primary>
62<secondary>configuring</secondary></indexterm>
63
64<indexterm zone="conf-sysvinit"><primary sortas="e-/etc/inittab">/etc/inittab</primary></indexterm>
65
66<para>Create a new <filename>/etc/inittab</filename> file by running the
67following:</para>
68
69<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
70# Begin /etc/inittab
71
72id:3:initdefault:
73
74si::sysinit:/etc/rc.d/init.d/rc sysinit
75
76l0:0:wait:/etc/rc.d/init.d/rc 0
77l1:S1:wait:/etc/rc.d/init.d/rc 1
78l2:2:wait:/etc/rc.d/init.d/rc 2
79l3:3:wait:/etc/rc.d/init.d/rc 3
80l4:4:wait:/etc/rc.d/init.d/rc 4
81l5:5:wait:/etc/rc.d/init.d/rc 5
82l6:6:wait:/etc/rc.d/init.d/rc 6
83
84ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
85
86su:S016:once:/sbin/sulogin
87
881:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
892:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
903:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
914:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
925:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
936:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
94
95# End /etc/inittab
96EOF</userinput></screen>
97
98<para> The <parameter>-I '\033(K'</parameter> switch tells <command>agetty</command> to send this escape sequence to
99the terminal before doing anything else. This escape sequence switches the
100console character set to a user-defined one, which can be modified by
101running the <command>setfont</command> program.
102Actually, the <command>console</command> initscript from the LFS-Bootscripts
103package calls the <command>setfont</command> program during system
104startup. Sending this escape sequence is necessary for
105people who use non-ISO-8859-1 screen font, but does not hurt native English
106speakers.</para>
107
108</sect2>
109
110
111<sect2 id="contents-sysvinit" role="content"><title>Contents of Sysvinit</title>
112
113<segmentedlist>
114<segtitle>Installed programs</segtitle>
115<seglistitem><seg>halt, init, killall5, last, lastb (link to last), mesg, pidof (link to
116killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit
117(link to init), utmpdump and wall</seg></seglistitem>
118</segmentedlist>
119
120<variablelist><title>Short descriptions</title>
121
122<varlistentry id="halt">
123<term><command>halt</command></term>
124<listitem>
125<indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm>
126<para>normally invokes <command>shutdown</command> with the <parameter>-h</parameter> flag,
127except when already in run-level 0, then it tells the kernel to halt the system.
128But first it notes in the file <filename>/var/log/wtmp</filename> that the
129system is being brought down.</para>
130</listitem>
131</varlistentry>
132
133<varlistentry id="init">
134<term><command>init</command></term>
135<listitem>
136<indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm>
137<para>is the mother of all processes. It reads its
138commands from <filename>/etc/inittab</filename>, which normally tell it which
139scripts to run for which run-level, and how many gettys to spawn.</para>
140</listitem>
141</varlistentry>
142
143<varlistentry id="killall5">
144<term><command>killall5</command></term>
145<listitem>
146<indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm>
147<para>sends a signal to all processes, except the processes in its own session --
148so it won't kill the shell running the script that called it.</para>
149</listitem>
150</varlistentry>
151
152<varlistentry id="last">
153<term><command>last</command></term>
154<listitem>
155<indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm>
156<para>shows which users last logged in (and out),
157searching back through the file <filename>/var/log/wtmp</filename>. It can
158also show system boots and shutdowns, and run-level changes.</para>
159</listitem>
160</varlistentry>
161
162<varlistentry id="lastb">
163<term><command>lastb</command></term>
164<listitem>
165<indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm>
166<para>shows the failed login attempts, as logged in
167<filename>/var/log/btmp</filename>.</para>
168</listitem>
169</varlistentry>
170
171<varlistentry id="mesg">
172<term><command>mesg</command></term>
173<listitem>
174<indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm>
175<para>controls whether other users can send
176messages to the current user's terminal.</para>
177</listitem>
178</varlistentry>
179
180<varlistentry id="pidof">
181<term><command>pidof</command></term>
182<listitem>
183<indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm>
184<para>reports the PIDs of the given programs.</para>
185</listitem>
186</varlistentry>
187
188<varlistentry id="poweroff">
189<term><command>poweroff</command></term>
190<listitem>
191<indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm>
192<para>tells the kernel to halt the system and
193switch off the computer. But see <command>halt</command>.</para>
194</listitem>
195</varlistentry>
196
197<varlistentry id="reboot">
198<term><command>reboot</command></term>
199<listitem>
200<indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm>
201<para>tells the kernel to reboot the system. But see <command>halt</command>.</para>
202</listitem>
203</varlistentry>
204
205<varlistentry id="runlevel">
206<term><command>runlevel</command></term>
207<listitem>
208<indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm>
209<para>reports the previous and the current run-level, as noted in the last run-level
210record in <filename>/var/run/utmp</filename>.</para>
211</listitem>
212</varlistentry>
213
214<varlistentry id="shutdown">
215<term><command>shutdown</command></term>
216<listitem>
217<indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm>
218<para>brings the system down in a secure way,
219signaling all processes and notifying all logged-in users.</para>
220</listitem>
221</varlistentry>
222
223<varlistentry id="sulogin">
224<term><command>sulogin</command></term>
225<listitem>
226<indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm>
227<para>allows the superuser to log in. It is
228normally invoked by <command>init</command> when the system goes into single user mode.</para>
229</listitem>
230</varlistentry>
231
232<varlistentry id="telinit">
233<term><command>telinit</command></term>
234<listitem>
235<indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm>
236<para>tells <command>init</command> which run-level to enter.</para>
237</listitem>
238</varlistentry>
239
240<varlistentry id="utmpdump">
241<term><command>utmpdump</command></term>
242<listitem>
243<indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm>
244<para>displays the content of the given login file in a friendlier format.</para>
245</listitem>
246</varlistentry>
247
248<varlistentry id="wall">
249<term><command>wall</command></term>
250<listitem>
251<indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm>
252<para>writes a message to all logged-in users.</para>
253</listitem>
254</varlistentry>
255</variablelist>
256
257</sect2>
258
259</sect1>
Note: See TracBrowser for help on using the repository browser.