1 .\" Copyright (c) 1980, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Donn Seeley at Berkeley Software Design, Inc.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 4. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)init.8 8.3 (Berkeley) 4/18/94
34 .Dd September 15, 2005
39 .Nd process control initialization
51 is the last stage of the boot process.
52 It normally runs the automatic reboot sequence as described in
54 and if this succeeds, begins multi-user operation.
55 If the reboot scripts fail,
57 commences single-user operation by giving
58 the super-user a shell on the console.
61 utility may be passed parameters
62 from the boot program to
63 prevent the system from going multi-user and to instead execute
64 a single-user shell without starting the normal daemons.
65 The system is then quiescent for maintenance work and may
66 later be made to go to multi-user by exiting the
67 single-user shell (with ^D).
73 start up command file in fastboot mode (skipping disk checks).
83 will require that the super-user password be
84 entered before the system will start a single-user shell.
85 The password check is skipped if the
90 If the system security level (see
92 is initially nonzero, then
97 raises the level to 1 before going multi-user for the first time.
98 Since the level cannot be reduced, it will be at least 1 for
99 subsequent operation, even on return to single-user.
100 If a level higher than 1 is desired while running multi-user,
101 it can be set before going multi-user, e.g., by the startup script
107 variable to the required security level.
111 is run in a jail, the security level of the
113 will not be affected.
114 Part of the information set up in the kernel to support a jail
115 is a per-jail security level.
116 This allows running a higher security level inside of a jail
117 than that of the host system.
120 for more information about jails.
122 In multi-user operation,
125 processes for the terminal ports found in the file
129 utility reads this file and executes the command found in the second field,
130 unless the first field refers to a device in
132 which is not configured.
133 The first field is supplied as the final argument to the command.
134 This command is usually
137 opens and initializes the tty line
144 program, when a valid user logs in,
145 executes a shell for that user.
147 dies, either because the user logged out
148 or an abnormal termination occurred (a signal),
151 utility wakes up, deletes the user
154 file of current users and records the logout in the
166 utility can also be used to keep arbitrary daemons running,
167 automatically restarting them if they die.
168 In this case, the first field in the
170 file must not reference the path to a configured device node
171 and will be passed to the daemon
172 as the final argument on its command line.
173 This is similar to the facility offered in the
177 Line status (on, off, secure, getty, or window information)
178 may be changed in the
180 file without a reboot by sending the signal
185 .Dq Li "kill -HUP 1" .
186 On receipt of this signal,
191 When a line is turned off in
194 will send a SIGHUP signal to the controlling process
195 for the session associated with the line.
196 For any lines that were previously turned off in the
200 executes the command specified in the second field.
201 If the command or window field for a line is changed,
202 the change takes effect at the end of the current
203 login session (e.g., the next time
205 starts a process on the line).
206 If a line is commented out or deleted from
209 will not do anything at all to that line.
210 However, it will complain that the relationship between lines
213 file and records in the
216 so this practice is not recommended.
220 utility will terminate multi-user operations and resume single-user mode
224 .Dq Li "kill \-TERM 1" .
225 If there are processes outstanding that are deadlocked (because of
226 hardware or software failure),
228 will not wait for them all to die (which might take forever), but
229 will time out after 30 seconds and print a warning message.
233 utility will cease creating new processes
234 and allow the system to slowly die away, if it is sent a terminal stop
237 .Dq Li "kill \-TSTP 1" .
238 A later hangup will resume full
239 multi-user operations, or a terminate will start a single-user shell.
247 utility will terminate all possible processes (again, it will not wait
248 for deadlocked processes) and reboot the machine if sent the interrupt
251 .Dq Li "kill \-INT 1".
252 This is useful for shutting the machine down cleanly from inside the kernel
253 or from X when the machine appears to be hung.
257 utility will do the same, except it will halt the machine if sent
258 the user defined signal 1
260 or will halt and turn the power off (if hardware permits) if sent
261 the user defined signal 2
264 When shutting down the machine,
269 This script can be used to cleanly terminate specific programs such
272 (the InterNetNews server).
273 If this script does not terminate within 120 seconds,
276 The timeout can be configured via the
279 .Va kern.init_shutdown_timeout .
283 is so critical that if it dies, the system will reboot itself
285 If, at bootstrap time, the
287 process cannot be located, the system will panic with the message
288 .Dq "panic: init died (signal %d, exit %d)" .
290 If run as a user process as shown in the second synopsis line,
294 behavior, i.e., super-user can specify the desired
296 on a command line, and
298 will signal the original
302 .Bl -column Run-level SIGTERM
303 .It Sy "Run-level Signal Action
304 .It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off"
305 .It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode"
306 .It Cm 6 Ta Dv SIGINT Ta "Reboot the machine"
307 .It Cm c Ta Dv SIGTSTP Ta "Block further logins"
308 .It Cm q Ta Dv SIGHUP Ta Rescan the
313 .Bl -tag -width /etc/rc.shutdown -compact
315 system console device
317 terminal ports found in
320 record of current users on the system
322 record of all logins and logouts
324 the terminal initialization information file
326 system startup commands
327 .It Pa /etc/rc.shutdown
328 system shutdown commands
332 .It "getty repeating too quickly on port %s, sleeping."
333 A process being started to service a line is exiting quickly
334 each time it is started.
335 This is often caused by a ringing or noisy terminal line.
337 Init will sleep for 30 seconds,
338 then continue trying to start the process.
340 .It "some processes would not die; ps axl advised."
342 is hung and could not be killed when the system was shutting down.
343 This condition is usually caused by a process
344 that is stuck in a device driver because of
345 a persistent device error condition.
368 behave as though they have security level \-1.
370 Setting the security level above 1 too early in the boot sequence can
373 from repairing inconsistent file systems.
375 preferred location to set the security level is at the end of
377 after all multi-user startup actions are complete.