Sun Sep 1 19:13:18 2019 UTC ()
Remove superfluous Pp.


(wiz)
diff -r1.61 -r1.62 src/sbin/init/init.8

cvs diff -r1.61 -r1.62 src/sbin/init/init.8 (switch to unified diff)

--- src/sbin/init/init.8 2019/09/01 18:51:27 1.61
+++ src/sbin/init/init.8 2019/09/01 19:13:18 1.62
@@ -1,390 +1,389 @@ @@ -1,390 +1,389 @@
1.\" $NetBSD: init.8,v 1.61 2019/09/01 18:51:27 sevan Exp $ 1.\" $NetBSD: init.8,v 1.62 2019/09/01 19:13:18 wiz Exp $
2.\" 2.\"
3.\" Copyright (c) 1980, 1991, 1993 3.\" Copyright (c) 1980, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to Berkeley by 6.\" This code is derived from software contributed to Berkeley by
7.\" Donn Seeley at Berkeley Software Design, Inc. 7.\" Donn Seeley at Berkeley Software Design, Inc.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
17.\" 3. Neither the name of the University nor the names of its contributors 17.\" 3. Neither the name of the University nor the names of its contributors
18.\" may be used to endorse or promote products derived from this software 18.\" may be used to endorse or promote products derived from this software
19.\" without specific prior written permission. 19.\" without specific prior written permission.
20.\" 20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" @(#)init.8 8.6 (Berkeley) 5/26/95 33.\" @(#)init.8 8.6 (Berkeley) 5/26/95
34.\" 34.\"
35.Dd September 1, 2019 35.Dd September 1, 2019
36.Dt INIT 8 36.Dt INIT 8
37.Os 37.Os
38.Sh NAME 38.Sh NAME
39.Nm init 39.Nm init
40.Nd process control initialization 40.Nd process control initialization
41.Sh SYNOPSIS 41.Sh SYNOPSIS
42.Nm 42.Nm
43.Op Fl s 43.Op Fl s
44.Sh DESCRIPTION 44.Sh DESCRIPTION
45The 45The
46.Nm 46.Nm
47program is the last stage of the boot process. 47program is the last stage of the boot process.
48It normally begins multi-user operation. 48It normally begins multi-user operation.
49.Pp 49.Pp
50.Nm 50.Nm
51is executed automatically by the kernel, 51is executed automatically by the kernel,
52after the kernel has initialised all devices 52after the kernel has initialised all devices
53and mounted the root file system. 53and mounted the root file system.
54The kernel may try multiple possible paths for 54The kernel may try multiple possible paths for
55.Nm , 55.Nm ,
56including 56including
57.Pa /sbin/init , 57.Pa /sbin/init ,
58.Pa /sbin/oinit , 58.Pa /sbin/oinit ,
59.Pa /sbin/init.bak , 59.Pa /sbin/init.bak ,
60and 60and
61.Pa /rescue/init . 61.Pa /rescue/init .
62.Pp 62.Pp
63The following table describes the state machine used by 63The following table describes the state machine used by
64.Nm : 64.Nm :
65.Bl -enum 65.Bl -enum
66.It 66.It
67Single user shell. 67Single user shell.
68If the kernel is booted in single user mode (see 68If the kernel is booted in single user mode (see
69.Xr boothowto 9 ) , 69.Xr boothowto 9 ) ,
70then the kernel will pass the 70then the kernel will pass the
71.Fl s 71.Fl s
72option to 72option to
73.Nm 73.Nm
74to prevent the system from going multi-user and 74to prevent the system from going multi-user and
75to instead execute a single user shell without starting the normal 75to instead execute a single user shell without starting the normal
76daemons. 76daemons.
77If the kernel is in a secure mode, 77If the kernel is in a secure mode,
78.Nm 78.Nm
79will downgrade it to securelevel 0 (insecure mode). 79will downgrade it to securelevel 0 (insecure mode).
80The system is then quiescent for maintenance work and may 80The system is then quiescent for maintenance work and may
81later be made to go to state 2 (multi-user) by exiting the single-user 81later be made to go to state 2 (multi-user) by exiting the single-user
82shell (with ^D). 82shell (with ^D).
83.It 83.It
84Multi-user boot (default operation). 84Multi-user boot (default operation).
85Executes 85Executes
86.Pa /etc/rc 86.Pa /etc/rc
87(see 87(see
88.Xr rc 8 ) . 88.Xr rc 8 ) .
89If this was the first state entered (as opposed to entering here after 89If this was the first state entered (as opposed to entering here after
90state 1), then 90state 1), then
91.Pa /etc/rc 91.Pa /etc/rc
92will be invoked with its first argument being 92will be invoked with its first argument being
93.Sq autoboot . 93.Sq autoboot .
94If 94If
95.Pa /etc/rc 95.Pa /etc/rc
96exits with a non-zero (error) exit code, commence single user 96exits with a non-zero (error) exit code, commence single user
97operation by giving the super-user a shell on the console by going 97operation by giving the super-user a shell on the console by going
98to state 1 (single user). 98to state 1 (single user).
99Otherwise, proceed to state 3. 99Otherwise, proceed to state 3.
100.Pp 100.Pp
101If value of the 101If value of the
102.Dq init.root 102.Dq init.root
103sysctl node is not equal to 103sysctl node is not equal to
104.Pa / 104.Pa /
105at this point, the 105at this point, the
106.Pa /etc/rc 106.Pa /etc/rc
107process will be run inside a 107process will be run inside a
108.Xr chroot 2 108.Xr chroot 2
109indicated by sysctl with the same error handling as above. 109indicated by sysctl with the same error handling as above.
110.Pp 110.Pp
111If the administrator has not set the security level to \-1 111If the administrator has not set the security level to \-1
112to indicate that the kernel should not run multiuser in secure 112to indicate that the kernel should not run multiuser in secure
113mode, and the 113mode, and the
114.Pa /etc/rc 114.Pa /etc/rc
115script has not set a higher level of security 115script has not set a higher level of security
116than level 1, then 116than level 1, then
117.Nm 117.Nm
118will put the kernel into securelevel mode 1. 118will put the kernel into securelevel mode 1.
119See 119See
120.Xr rc.conf 5 120.Xr rc.conf 5
121and 121and
122.Xr secmodel_securelevel 9 122.Xr secmodel_securelevel 9
123for more information. 123for more information.
124.It 124.It
125Set up ttys as specified in 125Set up ttys as specified in
126.Xr ttys 5 . 126.Xr ttys 5 .
127See below for more information. 127See below for more information.
128On completion, continue to state 4. 128On completion, continue to state 4.
129If we did chroot in state 2, each 129If we did chroot in state 2, each
130.Xr getty 8 130.Xr getty 8
131process will be run in the same 131process will be run in the same
132.Xr chroot 2 132.Xr chroot 2
133path as in 2 (that is, the value of 133path as in 2 (that is, the value of
134.Dq init.root 134.Dq init.root
135sysctl is not re-read). 135sysctl is not re-read).
136.It 136.It
137Multi-user operation. 137Multi-user operation.
138Depending upon the signal received, change state appropriately; 138Depending upon the signal received, change state appropriately;
139on 139on
140.Dv SIGTERM , 140.Dv SIGTERM ,
141go to state 7; 141go to state 7;
142on 142on
143.Dv SIGHUP , 143.Dv SIGHUP ,
144go to state 5; 144go to state 5;
145on 145on
146.Dv SIGTSTP , 146.Dv SIGTSTP ,
147go to state 6. 147go to state 6.
148.It 148.It
149Clean-up mode; re-read 149Clean-up mode; re-read
150.Xr ttys 5 , 150.Xr ttys 5 ,
151killing off the controlling processes on lines that are now 151killing off the controlling processes on lines that are now
152.Sq off , 152.Sq off ,
153and starting processes that are newly 153and starting processes that are newly
154.Sq on . 154.Sq on .
155On completion, go to state 4. 155On completion, go to state 4.
156.It 156.It
157.Sq Boring 157.Sq Boring
158mode; no new sessions. 158mode; no new sessions.
159Signals as per state 4. 159Signals as per state 4.
160.It 160.It
161Shutdown mode. 161Shutdown mode.
162Send 162Send
163.Dv SIGHUP 163.Dv SIGHUP
164to all controlling processes, reap the processes for 30 seconds, 164to all controlling processes, reap the processes for 30 seconds,
165and then go to state 1 (single user); warning if not all the processes died. 165and then go to state 1 (single user); warning if not all the processes died.
166.El 166.El
167.Pp 167.Pp
168If the 168If the
169.Sq console 169.Sq console
170entry in the 170entry in the
171.Xr ttys 5 171.Xr ttys 5
172file is marked 172file is marked
173.Dq insecure , 173.Dq insecure ,
174then 174then
175.Nm 175.Nm
176will require that the superuser password be 176will require that the superuser password be
177entered before the system will start a single-user shell. 177entered before the system will start a single-user shell.
178The password check is skipped if the 178The password check is skipped if the
179.Sq console 179.Sq console
180is marked as 180is marked as
181.Dq secure . 181.Dq secure .
182.Pp 182.Pp
183It should be noted that while 183It should be noted that while
184.Nm 184.Nm
185has the ability to start multi-user operation inside a 185has the ability to start multi-user operation inside a
186.Xr chroot 2 186.Xr chroot 2
187environment, the 187environment, the
188.Nm 188.Nm
189process itself will always run in the 189process itself will always run in the
190.Dq original root directory . 190.Dq original root directory .
191This also implies that single-user mode is always started in the original 191This also implies that single-user mode is always started in the original
192root, giving the possibility to create multi-user sessions in different 192root, giving the possibility to create multi-user sessions in different
193root directories over time. 193root directories over time.
194The 194The
195.Dq init.root 195.Dq init.root
196sysctl node is fabricated by 196sysctl node is fabricated by
197.Nm 197.Nm
198at startup and re-created any time it is found to be missing. 198at startup and re-created any time it is found to be missing.
199Type of the node is string capable of holding full pathname, and 199Type of the node is string capable of holding full pathname, and
200is only accessible by the superuser (unless explicitly destroyed 200is only accessible by the superuser (unless explicitly destroyed
201and re-created with different specification). 201and re-created with different specification).
202.Pp 202.Pp
203In multi-user operation, 203In multi-user operation,
204.Nm 204.Nm
205maintains 205maintains
206processes for the terminal ports found in the file 206processes for the terminal ports found in the file
207.Xr ttys 5 . 207.Xr ttys 5 .
208.Nm 208.Nm
209reads this file, and executes the command found in the second field. 209reads this file, and executes the command found in the second field.
210This command is usually 210This command is usually
211.Xr getty 8 ; 211.Xr getty 8 ;
212it opens and initializes the tty line and executes the 212it opens and initializes the tty line and executes the
213.Xr login 1 213.Xr login 1
214program. 214program.
215The 215The
216.Xr login 1 216.Xr login 1
217program, when a valid user logs in, executes a shell for that user. 217program, when a valid user logs in, executes a shell for that user.
218When this shell dies, either because the user logged out or an 218When this shell dies, either because the user logged out or an
219abnormal termination occurred (a signal), the 219abnormal termination occurred (a signal), the
220.Nm 220.Nm
221program wakes up, deletes the user from the 221program wakes up, deletes the user from the
222.Xr utmp 5 222.Xr utmp 5
223and 223and
224.Xr utmpx 5 224.Xr utmpx 5
225files of current users and records the logout in the 225files of current users and records the logout in the
226.Xr wtmp 5 226.Xr wtmp 5
227and 227and
228.Xr wtmpx 5 228.Xr wtmpx 5
229files. 229files.
230The cycle is 230The cycle is
231then restarted by 231then restarted by
232.Nm 232.Nm
233executing a new 233executing a new
234.Xr getty 8 234.Xr getty 8
235for the line. 235for the line.
236.Pp 236.Pp
237Line status (on, off, secure, getty, or window information) 237Line status (on, off, secure, getty, or window information)
238may be changed in the 238may be changed in the
239.Xr ttys 5 239.Xr ttys 5
240file without a reboot by sending the signal 240file without a reboot by sending the signal
241.Dv SIGHUP 241.Dv SIGHUP
242to 242to
243.Nm 243.Nm
244with the command 244with the command
245.Dq Li "kill \-s HUP 1" . 245.Dq Li "kill \-s HUP 1" .
246This is referenced in the table above as state 5. 246This is referenced in the table above as state 5.
247On receipt of this signal, 247On receipt of this signal,
248.Nm 248.Nm
249re-reads the 249re-reads the
250.Xr ttys 5 250.Xr ttys 5
251file. 251file.
252When a line is turned off in 252When a line is turned off in
253.Xr ttys 5 , 253.Xr ttys 5 ,
254.Nm 254.Nm
255will send a 255will send a
256.Dv SIGHUP 256.Dv SIGHUP
257signal to the controlling process 257signal to the controlling process
258for the session associated with the line. 258for the session associated with the line.
259For any lines that were previously turned off in the 259For any lines that were previously turned off in the
260.Xr ttys 5 260.Xr ttys 5
261file and are now on, 261file and are now on,
262.Nm 262.Nm
263executes a new 263executes a new
264.Xr getty 8 264.Xr getty 8
265to enable a new login. 265to enable a new login.
266If the getty or window field for a line is changed, 266If the getty or window field for a line is changed,
267the change takes effect at the end of the current 267the change takes effect at the end of the current
268login session (e.g., the next time 268login session (e.g., the next time
269.Nm 269.Nm
270starts a process on the line). 270starts a process on the line).
271If a line is commented out or deleted from 271If a line is commented out or deleted from
272.Xr ttys 5 , 272.Xr ttys 5 ,
273.Nm 273.Nm
274will not do anything at all to that line. 274will not do anything at all to that line.
275However, it will complain that the relationship between lines 275However, it will complain that the relationship between lines
276in the 276in the
277.Xr ttys 5 277.Xr ttys 5
278file and records in the 278file and records in the
279.Xr utmp 5 279.Xr utmp 5
280file is out of sync, 280file is out of sync,
281so this practice is not recommended. 281so this practice is not recommended.
282.Pp 282.Pp
283.Nm 283.Nm
284will terminate multi-user operations and resume single-user mode 284will terminate multi-user operations and resume single-user mode
285if sent a terminate 285if sent a terminate
286.Pq Dv TERM 286.Pq Dv TERM
287signal, for example, 287signal, for example,
288.Dq Li "kill \-s TERM 1" . 288.Dq Li "kill \-s TERM 1" .
289If there are processes outstanding that are deadlocked (because of 289If there are processes outstanding that are deadlocked (because of
290hardware or software failure), 290hardware or software failure),
291.Nm 291.Nm
292will not wait for them all to die (which might take forever), but 292will not wait for them all to die (which might take forever), but
293will time out after 30 seconds and print a warning message. 293will time out after 30 seconds and print a warning message.
294.Pp 294.Pp
295.Nm 295.Nm
296will cease creating new 296will cease creating new
297.Xr getty 8 Ns 's 297.Xr getty 8 Ns 's
298and allow the system to slowly die away, if it is sent a terminal stop 298and allow the system to slowly die away, if it is sent a terminal stop
299.Pq Dv TSTP 299.Pq Dv TSTP
300signal, i.e., 300signal, i.e.,
301.Dq Li "kill \-s TSTP 1" . 301.Dq Li "kill \-s TSTP 1" .
302A later hangup will resume full 302A later hangup will resume full
303multi-user operations, or a terminate will start a single user shell. 303multi-user operations, or a terminate will start a single user shell.
304This hook is used by 304This hook is used by
305.Xr reboot 8 305.Xr reboot 8
306and 306and
307.Xr halt 8 . 307.Xr halt 8 .
308.Pp 308.Pp
309The role of 309The role of
310.Nm 310.Nm
311is so critical that if it dies, the system will reboot itself 311is so critical that if it dies, the system will reboot itself
312automatically. 312automatically.
313If, at bootstrap time, the 313If, at bootstrap time, the
314.Nm 314.Nm
315process cannot be located, or exits during its initialisation, 315process cannot be located, or exits during its initialisation,
316the system will panic with the message 316the system will panic with the message
317.Dq panic: init died (signal %d, exit %d) . 317.Dq panic: init died (signal %d, exit %d) .
318.Pp 318.Pp
319If 319If
320.Pa /dev/console 320.Pa /dev/console
321does not exist, 321does not exist,
322.Nm 322.Nm
323will cd to 323will cd to
324.Pa /dev 324.Pa /dev
325and run 325and run
326.Dq Li "MAKEDEV -MM init" . 326.Dq Li "MAKEDEV -MM init" .
327.Xr MAKEDEV 8 327.Xr MAKEDEV 8
328will use 328will use
329.Xr mount_tmpfs 8 329.Xr mount_tmpfs 8
330or 330or
331.Xr mount_mfs 8 331.Xr mount_mfs 8
332to create a memory file system mounted over 332to create a memory file system mounted over
333.Pa /dev 333.Pa /dev
334that contains the standard devices considered necessary to boot the system. 334that contains the standard devices considered necessary to boot the system.
335.Sh FILES 335.Sh FILES
336.Bl -tag -width /var/log/wtmp{,x} -compact 336.Bl -tag -width /var/log/wtmp{,x} -compact
337.It Pa /dev/console 337.It Pa /dev/console
338System console device. 338System console device.
339.It Pa /dev/tty* 339.It Pa /dev/tty*
340Terminal ports found in 340Terminal ports found in
341.Xr ttys 5 . 341.Xr ttys 5 .
342.It Pa /var/run/utmp{,x} 342.It Pa /var/run/utmp{,x}
343Record of current users on the system. 343Record of current users on the system.
344.It Pa /var/log/wtmp{,x} 344.It Pa /var/log/wtmp{,x}
345Record of all logins and logouts. 345Record of all logins and logouts.
346.It Pa /etc/ttys 346.It Pa /etc/ttys
347The terminal initialization information file. 347The terminal initialization information file.
348.It Pa /etc/rc 348.It Pa /etc/rc
349System startup commands. 349System startup commands.
350.El 350.El
351.Sh DIAGNOSTICS 351.Sh DIAGNOSTICS
352.Bl -diag 352.Bl -diag
353.It "getty repeating too quickly on port %s, sleeping" 353.It "getty repeating too quickly on port %s, sleeping"
354A process being started to service a line is exiting quickly 354A process being started to service a line is exiting quickly
355each time it is started. 355each time it is started.
356This is often caused by a ringing or noisy terminal line. 356This is often caused by a ringing or noisy terminal line.
357.Em "Init will sleep for 10 seconds" , 357.Em "Init will sleep for 10 seconds" ,
358.Em "then continue trying to start the process" . 358.Em "then continue trying to start the process" .
359.Pp 
360.It "some processes would not die; ps axl advised." 359.It "some processes would not die; ps axl advised."
361A process is hung and could not be killed when the system was 360A process is hung and could not be killed when the system was
362shutting down. 361shutting down.
363This condition is usually caused by a process that is stuck in a 362This condition is usually caused by a process that is stuck in a
364device driver because of a persistent device error condition. 363device driver because of a persistent device error condition.
365.El 364.El
366.Sh SEE ALSO 365.Sh SEE ALSO
367.Xr config 1 , 366.Xr config 1 ,
368.Xr kill 1 , 367.Xr kill 1 ,
369.Xr login 1 , 368.Xr login 1 ,
370.Xr sh 1 , 369.Xr sh 1 ,
371.Xr options 4 , 370.Xr options 4 ,
372.Xr ttys 5 , 371.Xr ttys 5 ,
373.Xr getty 8 , 372.Xr getty 8 ,
374.Xr halt 8 , 373.Xr halt 8 ,
375.Xr MAKEDEV 8 , 374.Xr MAKEDEV 8 ,
376.Xr MAKEDEV.local 8 , 375.Xr MAKEDEV.local 8 ,
377.Xr mount_mfs 8 , 376.Xr mount_mfs 8 ,
378.Xr mount_tmpfs 8 , 377.Xr mount_tmpfs 8 ,
379.Xr rc 8 , 378.Xr rc 8 ,
380.Xr reboot 8 , 379.Xr reboot 8 ,
381.Xr rescue 8 , 380.Xr rescue 8 ,
382.Xr shutdown 8 , 381.Xr shutdown 8 ,
383.Xr sysctl 8 , 382.Xr sysctl 8 ,
384.Xr secmodel_bsd44 9 , 383.Xr secmodel_bsd44 9 ,
385.Xr secmodel_securelevel 9 384.Xr secmodel_securelevel 9
386.Sh HISTORY 385.Sh HISTORY
387An 386An
388.Nm 387.Nm
389command appeared in 388command appeared in
390.At v1 . 389.At v1 .