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