summaryrefslogtreecommitdiff
path: root/usr/src/man/man8/init.8
blob: cd811ae23f33725ba8cbeca9f2bd08efcbef2feb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
'\" te
.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright 1989 AT&T
.\" 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.
.\" 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
.\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH INIT 8 "Sep 2, 2009"
.SH NAME
init, telinit \- process control initialization
.SH SYNOPSIS
.LP
.nf
\fB/sbin/init\fR [0123456abcQqSs]
.fi

.LP
.nf
\fB/etc/telinit\fR [0123456abcQqSs]
.fi

.SH DESCRIPTION
.sp
.LP
\fBinit\fR is the default primordial user process. (Options given to the kernel
during boot may result in the invocation of an alternative primordial user
process, as described on \fBkernel\fR(8)). \fBinit\fR initiates the core
components of the service management facility, \fBsvc.configd\fR(8) and
\fBsvc.startd\fR(8), and restarts these components if they fail. For backwards
compatibility, \fBinit\fR also starts and restarts general processes according
to \fB/etc/inittab\fR, as desribed below.
.sp
.LP
The run levels and system booting descriptions given below are provided for
compatibility purposes only, and otherwise made obsolete by the service
management facility, \fBsmf\fR(7).
.SS "init Failure"
.sp
.LP
If \fBinit\fR exits for any reason other than system shutdown, it will be
restarted with process-\fBID\fR 1.
.SS "Run Level Defined"
.sp
.LP
At any given time, the system is in one of eight possible run levels. A run
level is a software configuration under which only a selected group of
processes exists. Processes spawned by \fBinit\fR for each of these run levels
are defined in \fB/etc/inittab\fR. \fBinit\fR can be in one of eight run
levels, \fB0\(mi6\fR and \fBS\fR or \fBs\fR (\fBS\fR and \fBs\fR are
identical). The run level changes when a privileged user runs \fB/sbin/init\fR.
.SS "init and System Booting"
.sp
.LP
When the system is booted, \fBinit\fR is invoked and the following occurs.
First, it reads \fB/etc/default/init\fR to set environment variables. This is
typically where \fBTZ\fR (time zone) and locale-related environments such as
\fBLANG\fR or \fBLC_CTYPE\fR get set. (See the FILES section at the end of this
page.) \fBinit\fR then looks in \fB/etc/inittab\fR for the \fBinitdefault\fR
entry (see \fBinittab\fR(5)). If the \fBinitdefault\fR entry:
.sp
.ne 2
.na
\fBexists\fR
.ad
.sp .6
.RS 4n
\fBinit\fR usually uses the run level specified in that entry as the initial
run level to enter only if the options/milestone property has not been
specified for \fBsvc.startd\fR(8).
.RE

.sp
.ne 2
.na
\fBdoes not exist\fR
.ad
.sp .6
.RS 4n
The service management facility, \fBsmf\fR(7), examines its configuration
specified in \fBsvc.startd\fR(8), and enters the milestone specified by the
options/milestone property.
.RE

.sp
.LP
The \fBinitdefault\fR entry in \fB/etc/inittab\fR corresponds to the following
run levels:
.sp
.ne 2
.na
\fB\fBS\fR or \fBs\fR\fR
.ad
.sp .6
.RS 4n
\fBinit\fR goes to the single-user state. In this state, the system console
device (\fB/dev/console\fR) is opened for reading and writing and the command
\fB/sbin/su\fR, (see \fBsu\fR(8)), is invoked. Use either \fBinit\fR or
\fBtelinit\fR to change the run level of the system. Note that if the shell is
terminated (using an end-of-file), \fBinit\fR only re-initializes to the
single-user state if \fB/etc/inittab\fR does not exist.
.RE

.sp
.ne 2
.na
\fB\fB0-6\fR\fR
.ad
.sp .6
.RS 4n
\fBinit\fR enters the corresponding run level. Run levels \fB0\fR, \fB5\fR, and
\fB6\fR are reserved states for shutting the system down. Run levels \fB2\fR,
\fB3\fR, and \fB4\fR are available as multi-user operating states.
.RE

.sp
.LP
If this is the first time since power up that \fBinit\fR has entered a run
level other than single-user state, \fBinit\fR first scans \fB/etc/inittab\fR
for \fBboot\fR and \fBbootwait\fR entries (see \fBinittab\fR(5)). These entries
are performed before any other processing of \fB/etc/inittab\fR takes place,
providing that the run level entered matches that of the entry. In this way any
special initialization of the operating system, such as mounting file systems,
can take place before users are allowed onto the system. \fBinit\fR then scans
\fB/etc/inittab\fR and executes all other entries that are to be processed for
that run level.
.sp
.LP
To spawn each process in \fB/etc/inittab\fR, \fBinit\fR reads each entry and
for each entry that should be respawned, it forks a child process. After it has
spawned all of the processes specified by \fB/etc/inittab\fR, \fBinit\fR waits
for one of its descendant processes to die, a \fBpowerfail\fR signal, or a
signal from another \fBinit\fR or \fBtelinit\fR process to change the system's
run level. When one of these conditions occurs, \fBinit\fR re-examines
\fB/etc/inittab\fR.
.SS "inittab Additions"
.sp
.LP
New entries can be added to \fB/etc/inittab\fR at any time; however, \fBinit\fR
still waits for one of the above three conditions to occur before re-examining
\fB/etc/inittab\fR. To get around this, \fBinit Q\fR or \fBinit q\fR command
wakes \fBinit\fR to re-examine \fB/etc/inittab\fR immediately.
.sp
.LP
When \fBinit\fR comes up at boot time and whenever the system changes from the
single-user state to another run state, \fBinit\fR sets the \fBioctl\fR(2)
states of the console to those modes saved in the file \fB/etc/ioctl.syscon\fR.
\fBinit\fR writes this file whenever the single-user state is entered.
.SS "Run Level Changes"
.sp
.LP
When a run level change request is made, \fBinit\fR or a designate sends the
warning signal (\fBSIGTERM\fR) to all processes that are undefined in the
target run level. A minimum interval of five seconds is observed before
\fBinit\fR or its designate forcibly terminates these processes by sending a
kill signal (\fBSIGKILL\fR). Additionally, init informs \fBsvc.startd\fR(8)
that the run level is changing. \fBsvc.startd\fR(8) then restricts the system
to the set of services which the milestone corresponding to the run-level
change depends on.
.sp
.LP
When \fBinit\fR receives a signal telling it that a process it spawned has
died, it records the fact and the reason it died in \fB/var/adm/utmpx\fR and
\fB/var/adm/wtmpx\fR if it exists (see \fBwho\fR(1)). A history of the
processes spawned is kept in \fB/var/adm/wtmpx.\fR
.sp
.LP
If \fBinit\fR receives a \fBpowerfail\fR signal (\fBSIGPWR\fR) it scans
\fB/etc/inittab\fR for special entries of the type \fBpowerfail\fR and
\fBpowerwait\fR. These entries are invoked (if the run levels permit) before
any further processing takes place. In this way \fBinit\fR can perform various
cleanup and recording functions during the powerdown of the operating system.
.SS "Environment Variables in /etc/default/init"
.sp
.LP
You can set default values for environment variables, for such items as
timezone and character formatting, in \fB/etc/default/init\fR. See the FILES
section, below, for a list of these variables.
.SS "telinit"
.sp
.LP
\fBtelinit\fR, which is linked to \fB/sbin/init\fR, is used to direct the
actions of \fBinit\fR. It takes a one-character argument and signals \fBinit\fR
to take the appropriate action.
.SH SECURITY
.sp
.LP
\fBinit\fR uses \fBpam\fR(3PAM) for session management. The \fBPAM\fR
configuration policy, listed through \fB/etc/pam.conf\fR, specifies the session
management module to be used for \fBinit\fR. Here is a partial \fBpam.conf\fR
file with entries for \fBinit\fR using the UNIX session management module.
.sp
.in +2
.nf
init   session   required    pam_unix_session.so.1
.fi
.in -2

.sp
.LP
If there are no entries for the \fBinit\fR service, then the entries for the
"other" service will be used.
.SH OPTIONS
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.sp .6
.RS 4n
Go into firmware.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.sp .6
.RS 4n
Put the system in system administrator mode. All local file systems are
mounted. Only a small set of essential kernel processes are left running. This
mode is for administrative tasks such as installing optional utility packages.
All files are accessible and no users are logged in on the system.
.sp
This request corresponds to a request for \fBsmf\fR(7) to restrict the system
milestone to svc:/milestone/single-user:default.
.RE

.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.sp .6
.RS 4n
Put the system in multi-user mode. All multi-user environment terminal
processes and daemons are spawned. This state is commonly referred to as the
multi-user state.
.sp
This request corresponds to a request for \fBsmf\fR(7) to restrict the system
milestone to svc:/milestone/multi-user:default.
.RE

.sp
.ne 2
.na
\fB\fB3\fR\fR
.ad
.sp .6
.RS 4n
Extend multi-user mode by making local resources available over the network.
.sp
This request corresponds to a request for \fBsmf\fR(7) to restrict the system
milestone to svc:/milestone/multi-user-server:default.
.RE

.sp
.ne 2
.na
\fB\fB4\fR\fR
.ad
.sp .6
.RS 4n
Is available to be defined as an alternative multi-user environment
configuration. It is not necessary for system operation and is usually not
used.
.RE

.sp
.ne 2
.na
\fB\fB5\fR\fR
.ad
.sp .6
.RS 4n
Shut the machine down so that it is safe to remove the power. Have the machine
remove power, if possible.
.RE

.sp
.ne 2
.na
\fB\fB6\fR\fR
.ad
.sp .6
.RS 4n
Stop the operating system and reboot to the state defined by the
\fBinitdefault\fR entry in \fB/etc/inittab\fR.
.sp
On x86 systems, service \fBsvc:/system/boot-config:default\fR is enabled by
default. When the \fBconfig/fastreboot_default\fR property is set to
\fBtrue\fR, \fBinit 6\fR will bypass the firmware.
.RE

.sp
.ne 2
.na
\fB\fBa\fR,\fBb\fR,\fBc\fR\fR
.ad
.sp .6
.RS 4n
Process only those \fB/etc/inittab\fR entries having the \fBa\fR, \fBb\fR, or
\fBc\fR run level set. These are pseudo-states, which may be defined to run
certain commands, but which do not cause the current run level to change.
.RE

.sp
.ne 2
.na
\fB\fBQ\fR,\fBq\fR\fR
.ad
.sp .6
.RS 4n
Re-examine \fB/etc/inittab\fR.
.RE

.sp
.ne 2
.na
\fB\fBS\fR, \fBs\fR\fR
.ad
.sp .6
.RS 4n
Enter single-user mode. This is the only run level that doesn't require the
existence of a properly formatted \fB/etc/inittab\fR file. If this file does
not exist, then by default, the only legal run level that \fBinit\fR can enter
is the single-user mode. When in single-user mode, the filesystems required for
basic system operation will be mounted. When the system comes down to
single-user mode, these file systems will remain mounted (even if provided by a
remote file server), and any other local filesystems will also be left mounted.
During the transition down to single-user mode, all processes started by
\fBinit\fR or \fBinit.d\fR scripts that should only be running in multi-user
mode are killed. In addition, any process that has a \fButmpx\fR entry will be
killed. This last condition insures that all port monitors started by the
\fBSAC\fR are killed and all services started by these port monitors, including
\fBttymon\fR login services, are killed.
.sp
This request corresponds to a request for \fBsmf\fR(7) to restrict the system
milestone to svc:/milestone/single-user:default.
.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/dev/console\fR\fR
.ad
.sp .6
.RS 4n
System console device.
.RE

.sp
.ne 2
.na
\fB\fB/etc/default/init\fR\fR
.ad
.sp .6
.RS 4n
Contains environment variables and their default values. For example, for the
timezone variable, \fBTZ\fR, you might specify \fBTZ=US/Pacific\fR. The
variables are:
.sp
.ne 2
.na
\fB\fBTZ\fR\fR
.ad
.sp .6
.RS 4n
Either specifies the timezone information (see \fBctime\fR(3C)) or the name of
a timezone information file \fB/usr/share/lib/zoneinfo\fR.
.sp
Refer to the \fBTIMEZONE\fR(5) man page before changing this setting.
.RE

.sp
.ne 2
.na
\fB\fBCMASK\fR\fR
.ad
.sp .6
.RS 4n
The mask (see \fBumask\fR(1)) that \fBinit\fR uses and that every process
inherits from the \fBinit\fR process. If not set, \fBinit\fR uses the mask it
inherits from the kernel. Note that \fBinit\fR always attempts to apply a
\fBumask\fR of 022 before creating a file, regardless of the setting of
\fBCMASK\fR
.RE

.sp
.ne 2
.na
\fB\fBLC_CTYPE\fR\fR
.ad
.sp .6
.RS 4n
Character characterization information
.RE

.sp
.ne 2
.na
\fB\fBLC_MESSAGES\fR\fR
.ad
.sp .6
.RS 4n
Message translation
.RE

.sp
.ne 2
.na
\fB\fBLC_MONETARY\fR\fR
.ad
.sp .6
.RS 4n
Monetary formatting information
.RE

.sp
.ne 2
.na
\fB\fBLC_NUMERIC\fR\fR
.ad
.sp .6
.RS 4n
Numeric formatting information
.RE

.sp
.ne 2
.na
\fB\fBLC_TIME\fR\fR
.ad
.sp .6
.RS 4n
Time formatting information
.RE

.sp
.ne 2
.na
\fB\fBLC_ALL\fR\fR
.ad
.sp .6
.RS 4n
If set, all other \fBLC_*\fR environmental variables take-on this value.
.RE

.sp
.ne 2
.na
\fB\fBLANG\fR\fR
.ad
.sp .6
.RS 4n
If \fBLC_ALL\fR is not set, and any particular \fBLC_*\fR is also not set, the
value of \fBLANG\fR is used for that particular environmental variable.
.RE

.RE

.sp
.ne 2
.na
\fB\fB/etc/inittab\fR\fR
.ad
.sp .6
.RS 4n
Controls process dispatching by \fBinit\fR.
.RE

.sp
.ne 2
.na
\fB\fB/etc/ioctl.syscon\fR\fR
.ad
.sp .6
.RS 4n
ioctl states of the console, as saved by \fBinit\fR when single-user state is
entered.
.RE

.sp
.ne 2
.na
\fB\fB/etc/svc/volatile/init.state\fR\fR
.ad
.sp .6
.RS 4n
\fBinit\fR state necessary to recover from failure.
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/utmpx\fR\fR
.ad
.sp .6
.RS 4n
User access and administration information.
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/wtmpx\fR\fR
.ad
.sp .6
.RS 4n
History of user access and administration information.
.RE

.sp
.ne 2
.na
\fB/var/run/initpipe\fR
.ad
.sp .6
.RS 4n
A named pipe used for internal communication.
.RE

.SH SEE ALSO
.sp
.LP
.BR login (1),
.BR sh (1),
.BR stty (1),
.BR who (1),
.BR ioctl (2),
.BR kill (2),
.BR ctime (3C),
.BR pam (3PAM),
.BR termio (4I),
.BR TIMEZONE (5),
.BR init.d (5),
.BR inittab (5),
.BR pam.conf (5),
.BR utmpx (5),
.BR attributes (7),
.BR pam_unix_session (7),
.BR smf (7),
.BR kernel (8),
.BR shutdown (8),
.BR su (8),
.BR svc.configd (8),
.BR svc.startd (8),
.BR ttymon (8)
.SH DIAGNOSTICS
.sp
.LP
If \fBinit\fR finds that it is respawning an entry from \fB/etc/inittab\fR more
than ten times in two minutes, it assumes that there is an error in the command
string in the entry and generates an error message on the system console. It
then refuses to respawn this entry until either five minutes has elapsed or it
receives a signal from a user-spawned \fBinit\fR or \fBtelinit\fR command. This
prevents \fBinit\fR from eating up system resources when someone makes a
typographical error in the \fBinittab\fR file, or a program is removed that is
referenced in \fB/etc/inittab\fR.
.SH NOTES
.sp
.LP
\fBinit\fR and \fBtelinit\fR can be run only by a privileged user.
.sp
.LP
The \fBS\fR or \fBs\fR state must not be used indiscriminately in
\fB/etc/inittab\fR. When modifying this file, it is best to avoid adding this
state to any line other than \fBinitdefault\fR.
.sp
.LP
If a default state is not specified in the \fBinitdefault\fR entry in
\fB/etc/inittab\fR, state \fB6\fR is entered. Consequently, the system will
loop by going to firmware and rebooting continuously.
.sp
.LP
If the \fButmpx\fR file cannot be created when booting the system, the system
will boot to state "\fBs\fR" regardless of the state specified in the
\fBinitdefault\fR entry in \fB/etc/inittab\fR. This can occur if the \fB/var\fR
file system is not accessible.
.sp
.LP
When a system transitions down to the \fBS\fR or \fBs\fR state, the
\fB/etc/nologin\fR file (see \fBnologin\fR(5)) is created. Upon subsequent
transition to run level 2, this file is removed.
.sp
.LP
\fBinit\fR uses \fB/var/run/initpipe\fR, a named pipe, for internal
communication.
.sp
.LP
The \fBpam_unix\fR(7) module is no longer supported. Similar functionality is
provided by \fBpam_unix_session\fR(7).