BSD 4_3_Reno release
[unix-history] / usr / src / sbin / init / init.8
CommitLineData
b891f6cd
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
1c15e888 5.\" @(#)init.8 6.3 (Berkeley) 6/24/90
b891f6cd 6.\"
1c15e888 7.TH INIT 8 "June 24, 1990"
b891f6cd
KM
8.UC 4
9.SH NAME
10init \- process control initialization
11.SH SYNOPSIS
12.B /etc/init
13.SH DESCRIPTION
14.I Init
15is invoked inside UNIX as the last step in the boot procedure.
16It normally then runs the automatic reboot sequence as described in
17.IR reboot (8),
18and if this succeeds, begins multi-user operation.
19If the reboot fails, it commences single user operation by giving
20the super-user a shell on the console. It is possible to pass parameters
21from the boot program to
22.I init
23so that single user operation is commenced immediately.
24When such single user operation is terminated by killing the single-user
25shell (i.e. by hitting ^D),
26.I init
27runs
28.I /etc/rc
29without the reboot parameter.
30This command file
31performs housekeeping operations
32such as removing temporary files,
33mounting file systems, and starting
34daemons.
35.PP
36In multi-user operation,
37.I init's
38role is to create a process for each
39terminal port on which a user may log in.
40To begin such operations, it reads the file
41.I /etc/ttys
42and
7f53c63b
KM
43executes a command for each terminal specified in the file.
44This command will usually be
c6f3090d 45.IR /usr/libexec/getty .
b891f6cd 46.I Getty
63c183b7 47opens and initializes the terminal line,
b891f6cd
KM
48reads the user's name and invokes
49.I login
50to log in the user and execute the Shell.
51.PP
52Ultimately the Shell will terminate
53because of an end-of-file either
54typed explicitly or generated as a result of hanging up.
55The main path of
56.IR init ,
57which has been waiting
58for such an event,
59wakes up and removes the appropriate entry from the
60file
61.IR utmp ,
62which records current users, and
63makes an entry in
c6f3090d 64.IR /var/log/wtmp ,
b891f6cd
KM
65which maintains a history
66of logins and logouts.
67The
68.I wtmp
69entry is made only if a user logged in successfully on the line.
70Then the appropriate terminal is reopened and
71.I getty
72is
73reinvoked.
74.PP
75.I Init
76catches the
77.I hangup
78signal (signal SIGHUP) and interprets it to mean that
79the file
80.I /etc/ttys
81should be read again.
82The Shell process on each line which used to be active
83in
84.I ttys
85but is no longer there is terminated;
86a new process is created for each added line;
87lines unchanged in the file are undisturbed.
63c183b7 88Thus it is possible to drop or add terminal lines without
b891f6cd
KM
89rebooting the system by changing the
90.I ttys
91file and sending a
92.I hangup
93signal to the
94.I init
95process: use `kill \-HUP 1.'
96.PP
97.I Init
98will terminate multi-user operations and resume single-user mode
99if sent a terminate (TERM) signal, i.e. ``kill \-TERM 1''.
100If there are processes outstanding which are deadlocked (due to
101hardware or software failure),
102.I init
103will not wait for them all to die (which might take forever), but
104will time out after 30 seconds and print a warning message.
105.PP
106.I Init
107will cease creating new
108.IR getty 's
109and allow the system to slowly die away, if it is sent a terminal stop (TSTP)
110signal, i.e. ``kill \-TSTP 1''. A later hangup will resume full
111multi-user operations, or a terminate will initiate a single user shell.
112This hook is used by
113.IR reboot (8)
114and
115.IR halt (8).
116.PP
117.I Init's
118role is so critical that if it dies, the system will reboot itself
119automatically.
120If, at bootstrap time, the
121.I init
122process cannot be located, the system will loop in user mode at location
1230x13.
124.SH DIAGNOSTICS
c6f3090d 125\fB/usr/libexec/getty\fP \fIgettyargs\fP\fB failing, sleeping\fP.
63c183b7
MK
126A process being started to service a line is exiting quickly
127each time it is started.
128This is often caused by a ringing or noisy terminal line.
129.I Init will sleep for 30 seconds, then continue trying to start the process.
b891f6cd
KM
130.LP
131\fBWARNING: Something is hung (wont die); ps axl advised\fR. A process
132is hung and could not be killed when the system was shutting down.
133This is usually caused by a process
134which is stuck in a device driver due to a persistent device error condition.
135.SH FILES
f2ba8c7e
KM
136/dev/console,
137/dev/tty*,
c6f3090d
TH
138/var/run/utmp,
139/var/log/wtmp,
f2ba8c7e
KM
140/etc/ttys,
141/etc/rc
b891f6cd 142.SH "SEE ALSO"
f2ba8c7e 143login(1), kill(1), sh(1), ttys(5), crash(8V), getty(8), rc(8), reboot(8),
b891f6cd 144halt(8), shutdown(8)