Commit | Line | Data |
---|---|---|
ce1056cb C |
1 | .TH INIT 8 "1 April 1981" |
2 | .UC 4 | |
3 | .SH NAME | |
4 | init \- process control initialization | |
5 | .SH SYNOPSIS | |
6 | .B /etc/init | |
7 | .SH DESCRIPTION | |
8 | .I Init | |
9 | is invoked inside UNIX as the last step in the boot procedure. | |
10 | It normally then runs the automatic reboot sequence as described in | |
11 | .IR reboot (8), | |
12 | and if this succeeds, begins multi-user operation. | |
13 | If the reboot fails, it commences single user operation by giving | |
14 | the super-user a shell on the console. It is possible to pass parameters | |
15 | from the boot program to | |
16 | .I init | |
17 | so that single user operation is commenced immediately. | |
18 | When such single user operation is terminated by killing the single-user | |
19 | shell (i.e. by hitting ^D), | |
20 | .I init | |
21 | runs | |
22 | .I /etc/rc | |
23 | without the reboot parameter. | |
24 | This command file | |
25 | performs housekeeping operations | |
26 | such as removing temporary files, | |
27 | mounting file systems, and starting | |
28 | daemons. | |
29 | .PP | |
30 | In multi-user operation, | |
31 | .I init's | |
32 | role is to create a process for each | |
33 | terminal port on which a user may log in. | |
34 | To begin such operations, it reads the file | |
35 | .I /etc/ttys | |
36 | and | |
37 | forks several times to create a process | |
38 | for each terminal specified in the file. | |
39 | Each of these processes opens the appropriate terminal | |
40 | for reading and writing. These channels thus | |
41 | receive file descriptors 0, 1 and 2, the standard input and | |
42 | output and the diagnostic output. | |
43 | Opening the terminal will usually involve a delay, | |
44 | since the | |
45 | .IR open "" | |
46 | is not completed until someone | |
47 | is dialed up and carrier established on the channel. | |
48 | If a terminal exists but an error occurs when trying to open the terminal | |
49 | .I init | |
50 | complains by writing a message to the system console; | |
51 | the message is repeated every 10 minutes for each such terminal | |
52 | until the terminal is shut off in /etc/ttys and init notified (by | |
53 | a hangup, as described below), or the terminal becomes accessible | |
54 | (init checks again every minute). | |
55 | After an open succeeds, | |
56 | .I /etc/getty | |
57 | is called with argument as specified by the second character of | |
58 | the | |
59 | .I ttys | |
60 | file line. | |
61 | .I Getty | |
62 | reads the user's name and invokes | |
63 | .I login | |
64 | to log in the user and execute the Shell. | |
65 | .PP | |
66 | Ultimately the Shell will terminate | |
67 | because of an end-of-file either | |
68 | typed explicitly or generated as a result of hanging up. | |
69 | The main path of | |
70 | .IR init , | |
71 | which has been waiting | |
72 | for such an event, | |
73 | wakes up and removes the appropriate entry from the | |
74 | file | |
75 | .IR utmp , | |
76 | which records current users, and | |
77 | makes an entry in | |
78 | .IR /usr/adm/wtmp , | |
79 | which maintains a history | |
80 | of logins and logouts. | |
81 | The | |
82 | .I wtmp | |
83 | entry is made only if a user logged in successfully on the line. | |
84 | Then the appropriate terminal is reopened and | |
85 | .I getty | |
86 | is | |
87 | reinvoked. | |
88 | .PP | |
89 | .I Init | |
90 | catches the | |
91 | .I hangup | |
92 | signal (signal SIGHUP) and interprets it to mean that | |
93 | the file | |
94 | .I /etc/ttys | |
95 | should be read again. | |
96 | The Shell process on each line which used to be active | |
97 | in | |
98 | .I ttys | |
99 | but is no longer there is terminated; | |
100 | a new process is created for each added line; | |
101 | lines unchanged in the file are undisturbed. | |
102 | Thus it is possible to drop or add phone lines without | |
103 | rebooting the system by changing the | |
104 | .I ttys | |
105 | file and sending a | |
106 | .I hangup | |
107 | signal to the | |
108 | .I init | |
109 | process: use `kill \-HUP 1.' | |
110 | .PP | |
111 | .I Init | |
112 | will terminate multi-user operations and resume single-user mode | |
113 | if sent a terminate (TERM) signal, i.e. ``kill \-TERM 1''. | |
114 | If there are processes outstanding which are deadlocked (due to | |
115 | hardware or software failure), | |
116 | .I init | |
117 | will not wait for them all to die (which might take forever), but | |
118 | will time out after 30 seconds and print a warning message. | |
119 | .PP | |
120 | .I Init | |
121 | will cease creating new | |
122 | .IR getty 's | |
123 | and allow the system to slowly die away, if it is sent a terminal stop (TSTP) | |
124 | signal, i.e. ``kill \-TSTP 1''. A later hangup will resume full | |
125 | multi-user operations, or a terminate will initiate a single user shell. | |
126 | This hook is used by | |
127 | .IR reboot (8) | |
128 | and | |
129 | .IR halt (8). | |
130 | .PP | |
131 | .I Init's | |
132 | role is so critical that if it dies, the system will reboot itself | |
133 | automatically. | |
134 | If, at bootstrap time, the | |
135 | .I init | |
136 | process cannot be located, the system will loop in user mode at location | |
137 | 0x13. | |
138 | .SH DIAGNOSTICS | |
139 | \fBinit: \fR\fItty\fR\|\fB: cannot open\fR. A terminal which is turned | |
140 | on in the \fIrc\fR file cannot be opened, likely because the requisite | |
141 | lines are either not configured into the system or the associated device | |
142 | was not attached during boot-time system configuration. | |
143 | .LP | |
144 | \fBWARNING: Something is hung (wont die); ps axl advised\fR. A process | |
145 | is hung and could not be killed when the system was shutting down. | |
146 | This is usually caused by a process | |
147 | which is stuck in a device driver due to a persistent device error condition. | |
148 | .SH FILES | |
149 | /dev/console, /dev/tty?, /etc/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc | |
150 | .SH "SEE ALSO" | |
151 | login(1), kill(1), sh(1), ttys(5), crash(8), getty(8), rc(8), reboot(8), | |
152 | halt(8), shutdown(8) |