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