source: chapter06/sysvinit.xml@ 2ec4b60

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 2ec4b60 was 2ec4b60, checked in by Zack Winkles <winkie@…>, 20 years ago

Normalized usage of sed throughout the book

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

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