xref: /original-bsd/sbin/init/init.8 (revision 8fbb78b3)
1.\" Copyright (c) 1980, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)init.8	6.4 (Berkeley) 04/29/91
7.\"
8.Dd
9.Dt INIT 8
10.Os BSD 4
11.Sh NAME
12.Nm init
13.Nd process control initialization
14.Sh SYNOPSIS
15.Nm init
16.Sh DESCRIPTION
17The
18.Nm init
19program
20is the last stage of the boot process.
21It normally runs the automatic reboot sequence as described in
22.Xr reboot 8 ,
23and if this succeeds, begins multi-user operation.
24If the reboot fails, it commences single user operation by giving
25the super-user a shell on the console.
26The
27.Nm init
28program
29may be passed parameters
30from the boot program to
31prevent the system from going multi-user and to instead execute
32a single user shell with out starting the normal daemons.
33The system is then quiescent for maintenance work and may
34later be made it go multi-user by killing the
35the single-user shell (with ^D).
36This
37causes
38.Nm init
39to run the
40.Pa /etc/rc
41start up command file without the reboot parameter.
42.Pp
43In multi-user operation,
44.Nm init
45maintains
46processes for the terminal ports found in the file
47.Xr ttys 5.
48.Nm Init
49reads this file, and executes the command found in the second field.
50This command is usually
51.Xr getty 8 ;
52.Xr getty
53opens and initializes the tty line
54and
55executes the
56.Xr login
57program.
58The
59.Xr login
60program, when a valid user logs in,
61exectutes a shell for that user.  When this shell
62dies, either because the user logged out
63or an abnormal termination occured (a signal),
64the
65.Nm init
66program wakes up, deletes the user
67from the
68.Xr utmp 5
69file of current users and records the logout in the
70.Xr wtmp
71file.
72The cycle is
73then restarted by
74.Nm init
75excuting a new
76.Xr getty
77for the line.
78.Pp
79Lines may be added or deleted from the
80.Xr ttys
81file without a reboot by sending the signal
82.Dv SIGHUP
83to
84.Nm init
85with the command
86.Dq Li "kill -HUP 1"
87Upon receipt of this signal,
88.Nm init
89re-reads the
90.Xr ttys
91file.
92Engaged (in use) ports
93are not disturbed,
94and if an engaged port has been deleted from the
95file, it will only become inactive after the engaging process has
96terminated (the user has logged off).
97If a port is inactive (only a
98.Xr getty
99or terminated processes are attached to it)
100.Nm init
101elimiates these processes.
102For these ports and any new ports, for which a command is found
103in the
104.Xr ttys
105file,
106.Nm init
107executes a new
108.Xr getty .
109.Pp
110.Nm Init
111will terminate multi-user operations and resume single-user mode
112if sent a terminate
113.Pq Dv TERM
114signal, for example,
115.Dq Li "kill \-TERM 1" .
116If there are processes outstanding which are deadlocked (due to
117hardware or software failure),
118.Xr init
119will not wait for them all to die (which might take forever), but
120will time out after 30 seconds and print a warning message.
121.Pp
122.Nm Init
123will cease creating new
124.Xr getty Ns 's
125and allow the system to slowly die away, if it is sent a terminal stop
126.Pq Dv TSTP
127signal, i.e.
128.Dq Li "kill \-TSTP 1" .
129A later hangup will resume full
130multi-user operations, or a terminate will initiate a single user shell.
131This hook is used by
132.Xr reboot 8
133and
134.Xr halt 8 .
135.Pp
136The role of
137.Nm init
138is so critical that if it dies, the system will reboot itself
139automatically.
140If, at bootstrap time, the
141.Xr init
142process cannot be located, the system will loop in user mode at location
1430x13.
144.Sh DIAGNOSTICS
145.Bl -diag
146.It "/usr/libexec/getty \\*(eMgettyargs\\*(fP failing, sleeping."
147A process being started to service a line is exiting quickly
148each time it is started.
149This is often caused by a ringing or noisy terminal line.
150.Em "Init will sleep for 30 seconds" ,
151.Em "then continue trying to start the process" .
152.Pp
153.It "WARNING: Something is hung (wont die); ps axl advised."
154A process
155is hung and could not be killed when the system was shutting down.
156This is usually caused by a process
157which is stuck in a device driver due to a persistent device error condition.
158.El
159.Sh FILES
160.Bl -tag -width /var/log/wtmp -compact
161.It Pa /dev/console
162System console device.
163.It Pa /dev/tty*
164Terminal ports found in
165.Xr ttys .
166.It Pa /var/run/utmp
167Record of Current users on the system.
168.It Pa /var/log/wtmp
169Record of all logins and logouts.
170.It Pa /etc/ttys
171The terminal initialization information file.
172.It Pa /etc/rc
173System startup commands.
174.El
175.Sh SEE ALSO
176.Xr login 1 ,
177.Xr kill 1 ,
178.Xr sh 1 ,
179.Xr ttys 5 ,
180.Xr crash 8 ,
181.Xr getty 8 ,
182.Xr rc 8 ,
183.Xr reboot 8 ,
184.Xr halt 8 ,
185.Xr shutdown 8
186.Sh HISTORY
187A
188.Nm
189command appeared in
190.At v6 .
191