source: chapter06/sysvinit.xml@ 456a1d92

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 456a1d92 was 456a1d92, checked in by Alexander E. Patrakov <alexander@…>, 20 years ago

Added sysvinit-2.85-proclen-1.patch to the book

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

  • Property mode set to 100644
File size: 9.1 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 "buffer overflow" bug.
32Under some conditions, it clobbers the
33values 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
38run-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
40misinterpretation, 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@&amp; 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
65following:</para>
66
67<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"</userinput>
68# Begin /etc/inittab
69
70id:3:initdefault:
71
72si::sysinit:/etc/rc.d/init.d/rc sysinit
73
74l0:0:wait:/etc/rc.d/init.d/rc 0
75l1:S1:wait:/etc/rc.d/init.d/rc 1
76l2:2:wait:/etc/rc.d/init.d/rc 2
77l3:3:wait:/etc/rc.d/init.d/rc 3
78l4:4:wait:/etc/rc.d/init.d/rc 4
79l5:5:wait:/etc/rc.d/init.d/rc 5
80l6:6:wait:/etc/rc.d/init.d/rc 6
81
82ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
83
84su:S016:once:/sbin/sulogin
85
861:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
872:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
883:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
894:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
905:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
916: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
97the terminal before doing anything else. This escape sequence switches the
98console character set to a user-defined one, which can be modified by
99running the <command>setfont</command> program.
100Actually, the <command>console</command> initscript from the LFS-Bootscripts
101package calls the <command>setfont</command> program during system
102startup. Sending this escape sequence is necessary for
103people who use non-ISO-8859-1 screen font, but does not hurt native English
104speakers.</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
114killall5), 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,
125except when already in run-level 0, then it tells the kernel to halt the system.
126But first it notes in the file <filename>/var/log/wtmp</filename> that the
127system 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
136commands from <filename>/etc/inittab</filename>, which normally tell it which
137scripts 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 --
146so 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),
155searching back through the file <filename>/var/log/wtmp</filename>. It can
156also 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
174messages 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
191switch 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
208record 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,
217signaling 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
226normally 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>
Note: See TracBrowser for help on using the repository browser.