Move everything from /var/adm to /var/log
[unleashed/lotheac.git] / share / man / man8 / init.8
blob09094e6d80f2221fc3c2f65754856816b69efc25
1 '\" te
2 .\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
5 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
6 .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH INIT 8 "Sep 2, 2009"
8 .SH NAME
9 init, telinit \- process control initialization
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fB/sbin/init\fR [0123456abcQqSs]
14 .fi
16 .LP
17 .nf
18 \fB/etc/telinit\fR [0123456abcQqSs]
19 .fi
21 .SH DESCRIPTION
22 .sp
23 .LP
24 \fBinit\fR is the default primordial user process. (Options given to the kernel
25 during boot may result in the invocation of an alternative primordial user
26 process, as described on \fBkernel\fR(8)). \fBinit\fR initiates the core
27 components of the service management facility, \fBsvc.configd\fR(8) and
28 \fBsvc.startd\fR(8), and restarts these components if they fail. For backwards
29 compatibility, \fBinit\fR also starts and restarts general processes according
30 to \fB/etc/inittab\fR, as desribed below.
31 .sp
32 .LP
33 The run levels and system booting descriptions given below are provided for
34 compatibility purposes only, and otherwise made obsolete by the service
35 management facility, \fBsmf\fR(5).
36 .SS "init Failure"
37 .sp
38 .LP
39 If \fBinit\fR exits for any reason other than system shutdown, it will be
40 restarted with process-\fBID\fR 1.
41 .SS "Run Level Defined"
42 .sp
43 .LP
44 At any given time, the system is in one of eight possible run levels. A run
45 level is a software configuration under which only a selected group of
46 processes exists. Processes spawned by \fBinit\fR for each of these run levels
47 are defined in \fB/etc/inittab\fR. \fBinit\fR can be in one of eight run
48 levels, \fB0\(mi6\fR and \fBS\fR or \fBs\fR (\fBS\fR and \fBs\fR are
49 identical). The run level changes when a privileged user runs \fB/sbin/init\fR.
50 .SS "init and System Booting"
51 .sp
52 .LP
53 When the system is booted, \fBinit\fR is invoked and the following occurs.
54 First, it reads \fB/etc/default/init\fR to set environment variables. This is
55 typically where \fBTZ\fR (time zone) and locale-related environments such as
56 \fBLANG\fR or \fBLC_CTYPE\fR get set. (See the FILES section at the end of this
57 page.) \fBinit\fR then looks in \fB/etc/inittab\fR for the \fBinitdefault\fR
58 entry (see \fBinittab\fR(4)). If the \fBinitdefault\fR entry:
59 .sp
60 .ne 2
61 .na
62 \fBexists\fR
63 .ad
64 .sp .6
65 .RS 4n
66 \fBinit\fR usually uses the run level specified in that entry as the initial
67 run level to enter only if the options/milestone property has not been
68 specified for \fBsvc.startd\fR(8).
69 .RE
71 .sp
72 .ne 2
73 .na
74 \fBdoes not exist\fR
75 .ad
76 .sp .6
77 .RS 4n
78 The service management facility, \fBsmf\fR(5), examines its configuration
79 specified in \fBsvc.startd\fR(8), and enters the milestone specified by the
80 options/milestone property.
81 .RE
83 .sp
84 .LP
85 The \fBinitdefault\fR entry in \fB/etc/inittab\fR corresponds to the following
86 run levels:
87 .sp
88 .ne 2
89 .na
90 \fB\fBS\fR or \fBs\fR\fR
91 .ad
92 .sp .6
93 .RS 4n
94 \fBinit\fR goes to the single-user state. In this state, the system console
95 device (\fB/dev/console\fR) is opened for reading and writing and the command
96 \fB/sbin/su\fR, (see \fBsu\fR(8)), is invoked. Use either \fBinit\fR or
97 \fBtelinit\fR to change the run level of the system. Note that if the shell is
98 terminated (using an end-of-file), \fBinit\fR only re-initializes to the
99 single-user state if \fB/etc/inittab\fR does not exist.
103 .ne 2
105 \fB\fB0-6\fR\fR
107 .sp .6
108 .RS 4n
109 \fBinit\fR enters the corresponding run level. Run levels \fB0\fR, \fB5\fR, and
110 \fB6\fR are reserved states for shutting the system down. Run levels \fB2\fR,
111 \fB3\fR, and \fB4\fR are available as multi-user operating states.
116 If this is the first time since power up that \fBinit\fR has entered a run
117 level other than single-user state, \fBinit\fR first scans \fB/etc/inittab\fR
118 for \fBboot\fR and \fBbootwait\fR entries (see \fBinittab\fR(4)). These entries
119 are performed before any other processing of \fB/etc/inittab\fR takes place,
120 providing that the run level entered matches that of the entry. In this way any
121 special initialization of the operating system, such as mounting file systems,
122 can take place before users are allowed onto the system. \fBinit\fR then scans
123 \fB/etc/inittab\fR and executes all other entries that are to be processed for
124 that run level.
127 To spawn each process in \fB/etc/inittab\fR, \fBinit\fR reads each entry and
128 for each entry that should be respawned, it forks a child process. After it has
129 spawned all of the processes specified by \fB/etc/inittab\fR, \fBinit\fR waits
130 for one of its descendant processes to die, a \fBpowerfail\fR signal, or a
131 signal from another \fBinit\fR or \fBtelinit\fR process to change the system's
132 run level. When one of these conditions occurs, \fBinit\fR re-examines
133 \fB/etc/inittab\fR.
134 .SS "inittab Additions"
137 New entries can be added to \fB/etc/inittab\fR at any time; however, \fBinit\fR
138 still waits for one of the above three conditions to occur before re-examining
139 \fB/etc/inittab\fR. To get around this, \fBinit Q\fR or \fBinit q\fR command
140 wakes \fBinit\fR to re-examine \fB/etc/inittab\fR immediately.
143 When \fBinit\fR comes up at boot time and whenever the system changes from the
144 single-user state to another run state, \fBinit\fR sets the \fBioctl\fR(2)
145 states of the console to those modes saved in the file \fB/etc/ioctl.syscon\fR.
146 \fBinit\fR writes this file whenever the single-user state is entered.
147 .SS "Run Level Changes"
150 When a run level change request is made, \fBinit\fR or a designate sends the
151 warning signal (\fBSIGTERM\fR) to all processes that are undefined in the
152 target run level. A minimum interval of five seconds is observed before
153 \fBinit\fR or its designate forcibly terminates these processes by sending a
154 kill signal (\fBSIGKILL\fR). Additionally, init informs \fBsvc.startd\fR(8)
155 that the run level is changing. \fBsvc.startd\fR(8) then restricts the system
156 to the set of services which the milestone corresponding to the run-level
157 change depends on.
160 When \fBinit\fR receives a signal telling it that a process it spawned has
161 died, it records the fact and the reason it died in \fB/var/log/utmpx\fR and
162 \fB/var/log/wtmpx\fR if it exists (see \fBwho\fR(1)). A history of the
163 processes spawned is kept in \fB/var/log/wtmpx.\fR
166 If \fBinit\fR receives a \fBpowerfail\fR signal (\fBSIGPWR\fR) it scans
167 \fB/etc/inittab\fR for special entries of the type \fBpowerfail\fR and
168 \fBpowerwait\fR. These entries are invoked (if the run levels permit) before
169 any further processing takes place. In this way \fBinit\fR can perform various
170 cleanup and recording functions during the powerdown of the operating system.
171 .SS "Environment Variables in /etc/default/init"
174 You can set default values for environment variables, for such items as
175 timezone and character formatting, in \fB/etc/default/init\fR. See the FILES
176 section, below, for a list of these variables.
177 .SS "telinit"
180 \fBtelinit\fR, which is linked to \fB/sbin/init\fR, is used to direct the
181 actions of \fBinit\fR. It takes a one-character argument and signals \fBinit\fR
182 to take the appropriate action.
183 .SH SECURITY
186 \fBinit\fR uses \fBpam\fR(3PAM) for session management. The \fBPAM\fR
187 configuration policy, listed through \fB/etc/pam.conf\fR, specifies the session
188 management module to be used for \fBinit\fR. Here is a partial \fBpam.conf\fR
189 file with entries for \fBinit\fR using the UNIX session management module.
191 .in +2
193 init   session   required    pam_unix_session.so.1
195 .in -2
199 If there are no entries for the \fBinit\fR service, then the entries for the
200 "other" service will be used.
201 .SH OPTIONS
203 .ne 2
205 \fB\fB0\fR\fR
207 .sp .6
208 .RS 4n
209 Go into firmware.
213 .ne 2
215 \fB\fB1\fR\fR
217 .sp .6
218 .RS 4n
219 Put the system in system administrator mode. All local file systems are
220 mounted. Only a small set of essential kernel processes are left running. This
221 mode is for administrative tasks such as installing optional utility packages.
222 All files are accessible and no users are logged in on the system.
224 This request corresponds to a request for \fBsmf\fR(5) to restrict the system
225 milestone to svc:/milestone/single-user:default.
229 .ne 2
231 \fB\fB2\fR\fR
233 .sp .6
234 .RS 4n
235 Put the system in multi-user mode. All multi-user environment terminal
236 processes and daemons are spawned. This state is commonly referred to as the
237 multi-user state.
239 This request corresponds to a request for \fBsmf\fR(5) to restrict the system
240 milestone to svc:/milestone/multi-user:default.
244 .ne 2
246 \fB\fB3\fR\fR
248 .sp .6
249 .RS 4n
250 Extend multi-user mode by making local resources available over the network.
252 This request corresponds to a request for \fBsmf\fR(5) to restrict the system
253 milestone to svc:/milestone/multi-user-server:default.
257 .ne 2
259 \fB\fB4\fR\fR
261 .sp .6
262 .RS 4n
263 Is available to be defined as an alternative multi-user environment
264 configuration. It is not necessary for system operation and is usually not
265 used.
269 .ne 2
271 \fB\fB5\fR\fR
273 .sp .6
274 .RS 4n
275 Shut the machine down so that it is safe to remove the power. Have the machine
276 remove power, if possible.
280 .ne 2
282 \fB\fB6\fR\fR
284 .sp .6
285 .RS 4n
286 Stop the operating system and reboot to the state defined by the
287 \fBinitdefault\fR entry in \fB/etc/inittab\fR.
289 On x86 systems, service \fBsvc:/system/boot-config:default\fR is enabled by
290 default. When the \fBconfig/fastreboot_default\fR property is set to
291 \fBtrue\fR, \fBinit 6\fR will bypass the firmware.
295 .ne 2
297 \fB\fBa\fR,\fBb\fR,\fBc\fR\fR
299 .sp .6
300 .RS 4n
301 Process only those \fB/etc/inittab\fR entries having the \fBa\fR, \fBb\fR, or
302 \fBc\fR run level set. These are pseudo-states, which may be defined to run
303 certain commands, but which do not cause the current run level to change.
307 .ne 2
309 \fB\fBQ\fR,\fBq\fR\fR
311 .sp .6
312 .RS 4n
313 Re-examine \fB/etc/inittab\fR.
317 .ne 2
319 \fB\fBS\fR, \fBs\fR\fR
321 .sp .6
322 .RS 4n
323 Enter single-user mode. This is the only run level that doesn't require the
324 existence of a properly formatted \fB/etc/inittab\fR file. If this file does
325 not exist, then by default, the only legal run level that \fBinit\fR can enter
326 is the single-user mode. When in single-user mode, the filesystems required for
327 basic system operation will be mounted. When the system comes down to
328 single-user mode, these file systems will remain mounted (even if provided by a
329 remote file server), and any other local filesystems will also be left mounted.
330 During the transition down to single-user mode, all processes started by
331 \fBinit\fR or \fBinit.d\fR scripts that should only be running in multi-user
332 mode are killed. In addition, any process that has a \fButmpx\fR entry will be
333 killed. This last condition insures that all port monitors started by the
334 \fBSAC\fR are killed and all services started by these port monitors, including
335 \fBttymon\fR login services, are killed.
337 This request corresponds to a request for \fBsmf\fR(5) to restrict the system
338 milestone to svc:/milestone/single-user:default.
341 .SH FILES
343 .ne 2
345 \fB\fB/dev/console\fR\fR
347 .sp .6
348 .RS 4n
349 System console device.
353 .ne 2
355 \fB\fB/etc/default/init\fR\fR
357 .sp .6
358 .RS 4n
359 Contains environment variables and their default values. For example, for the
360 timezone variable, \fBTZ\fR, you might specify \fBTZ=US/Pacific\fR. The
361 variables are:
363 .ne 2
365 \fB\fBTZ\fR\fR
367 .sp .6
368 .RS 4n
369 Either specifies the timezone information (see \fBctime\fR(3C)) or the name of
370 a timezone information file \fB/usr/share/zoneinfo\fR.
372 Refer to the \fBTIMEZONE\fR(4) man page before changing this setting.
376 .ne 2
378 \fB\fBCMASK\fR\fR
380 .sp .6
381 .RS 4n
382 The mask (see \fBumask\fR(1)) that \fBinit\fR uses and that every process
383 inherits from the \fBinit\fR process. If not set, \fBinit\fR uses the mask it
384 inherits from the kernel. Note that \fBinit\fR always attempts to apply a
385 \fBumask\fR of 022 before creating a file, regardless of the setting of
386 \fBCMASK\fR
390 .ne 2
392 \fB\fBLC_CTYPE\fR\fR
394 .sp .6
395 .RS 4n
396 Character characterization information
400 .ne 2
402 \fB\fBLC_MESSAGES\fR\fR
404 .sp .6
405 .RS 4n
406 Message translation
410 .ne 2
412 \fB\fBLC_MONETARY\fR\fR
414 .sp .6
415 .RS 4n
416 Monetary formatting information
420 .ne 2
422 \fB\fBLC_NUMERIC\fR\fR
424 .sp .6
425 .RS 4n
426 Numeric formatting information
430 .ne 2
432 \fB\fBLC_TIME\fR\fR
434 .sp .6
435 .RS 4n
436 Time formatting information
440 .ne 2
442 \fB\fBLC_ALL\fR\fR
444 .sp .6
445 .RS 4n
446 If set, all other \fBLC_*\fR environmental variables take-on this value.
450 .ne 2
452 \fB\fBLANG\fR\fR
454 .sp .6
455 .RS 4n
456 If \fBLC_ALL\fR is not set, and any particular \fBLC_*\fR is also not set, the
457 value of \fBLANG\fR is used for that particular environmental variable.
463 .ne 2
465 \fB\fB/etc/inittab\fR\fR
467 .sp .6
468 .RS 4n
469 Controls process dispatching by \fBinit\fR.
473 .ne 2
475 \fB\fB/etc/ioctl.syscon\fR\fR
477 .sp .6
478 .RS 4n
479 ioctl states of the console, as saved by \fBinit\fR when single-user state is
480 entered.
484 .ne 2
486 \fB\fB/etc/svc/volatile/init.state\fR\fR
488 .sp .6
489 .RS 4n
490 \fBinit\fR state necessary to recover from failure.
494 .ne 2
496 \fB\fB/var/log/utmpx\fR\fR
498 .sp .6
499 .RS 4n
500 User access and administration information.
504 .ne 2
506 \fB\fB/var/log/wtmpx\fR\fR
508 .sp .6
509 .RS 4n
510 History of user access and administration information.
514 .ne 2
516 \fB/var/run/initpipe\fR
518 .sp .6
519 .RS 4n
520 A named pipe used for internal communication.
523 .SH SEE ALSO
526 \fBlogin\fR(1), \fBsh\fR(1), \fBstty\fR(1), \fBwho\fR(1), \fBkernel\fR(8),
527 \fBshutdown\fR(8), \fBsu\fR(8), \fBsvc.configd\fR(8), \fBsvc.startd\fR(8),
528 \fBttymon\fR(8), \fBioctl\fR(2), \fBkill\fR(2), \fBctime\fR(3C),
529 \fBpam\fR(3PAM), \fBinit.d\fR(4), \fBinittab\fR(4), \fBpam.conf\fR(4),
530 \fBTIMEZONE\fR(4), \fButmpx\fR(4), \fBattributes\fR(5),
531 \fBpam_unix_session\fR(5), \fBsmf\fR(5), \fBtermio\fR(7I)
532 .SH DIAGNOSTICS
535 If \fBinit\fR finds that it is respawning an entry from \fB/etc/inittab\fR more
536 than ten times in two minutes, it assumes that there is an error in the command
537 string in the entry and generates an error message on the system console. It
538 then refuses to respawn this entry until either five minutes has elapsed or it
539 receives a signal from a user-spawned \fBinit\fR or \fBtelinit\fR command. This
540 prevents \fBinit\fR from eating up system resources when someone makes a
541 typographical error in the \fBinittab\fR file, or a program is removed that is
542 referenced in \fB/etc/inittab\fR.
543 .SH NOTES
546 \fBinit\fR and \fBtelinit\fR can be run only by a privileged user.
549 The \fBS\fR or \fBs\fR state must not be used indiscriminately in
550 \fB/etc/inittab\fR. When modifying this file, it is best to avoid adding this
551 state to any line other than \fBinitdefault\fR.
554 If a default state is not specified in the \fBinitdefault\fR entry in
555 \fB/etc/inittab\fR, state \fB6\fR is entered. Consequently, the system will
556 loop by going to firmware and rebooting continuously.
559 If the \fButmpx\fR file cannot be created when booting the system, the system
560 will boot to state "\fBs\fR" regardless of the state specified in the
561 \fBinitdefault\fR entry in \fB/etc/inittab\fR. This can occur if the \fB/var\fR
562 file system is not accessible.
565 When a system transitions down to the \fBS\fR or \fBs\fR state, the
566 \fB/etc/nologin\fR file (see \fBnologin\fR(4)) is created. Upon subsequent
567 transition to run level 2, this file is removed.
570 \fBinit\fR uses \fB/var/run/initpipe\fR, a named pipe, for internal
571 communication.
574 The \fBpam_unix\fR(5) module is no longer supported. Similar functionality is
575 provided by \fBpam_unix_session\fR(5).