'\" 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 1M "2 Sep 2009" "SunOS 5.11" "System Administration Commands" .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(1M)). \fBinit\fR initiates the core components of the service management facility, \fBsvc.configd\fR(1M) and \fBsvc.startd\fR(1M), 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(5). .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(4)). If the \fBinitdefault\fR entry: .sp .ne 2 .mk .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(1M). .RE .sp .ne 2 .mk .na \fBdoes not exist\fR .ad .sp .6 .RS 4n The service management facility, \fBsmf\fR(5), examines its configuration specified in \fBsvc.startd\fR(1M), 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 .mk .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(1M)), 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 .mk .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(4)). 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(1M) that the run level is changing. \fBsvc.startd\fR(1M) 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 .mk .na \fB\fB0\fR\fR .ad .sp .6 .RS 4n Go into firmware. .RE .sp .ne 2 .mk .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(5) to restrict the system milestone to svc:/milestone/single-user:default. .RE .sp .ne 2 .mk .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(5) to restrict the system milestone to svc:/milestone/multi-user:default. .RE .sp .ne 2 .mk .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(5) to restrict the system milestone to svc:/milestone/multi-user-server:default. .RE .sp .ne 2 .mk .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 .mk .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 .mk .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 .mk .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 .mk .na \fB\fBQ\fR,\fBq\fR\fR .ad .sp .6 .RS 4n Re-examine \fB/etc/inittab\fR. .RE .sp .ne 2 .mk .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(5) to restrict the system milestone to svc:/milestone/single-user:default. .RE .SH FILES .sp .ne 2 .mk .na \fB\fB/dev/console\fR\fR .ad .sp .6 .RS 4n System console device. .RE .sp .ne 2 .mk .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 .mk .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(4) man page before changing this setting. .RE .sp .ne 2 .mk .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 .mk .na \fB\fBLC_CTYPE\fR\fR .ad .sp .6 .RS 4n Character characterization information .RE .sp .ne 2 .mk .na \fB\fBLC_MESSAGES\fR\fR .ad .sp .6 .RS 4n Message translation .RE .sp .ne 2 .mk .na \fB\fBLC_MONETARY\fR\fR .ad .sp .6 .RS 4n Monetary formatting information .RE .sp .ne 2 .mk .na \fB\fBLC_NUMERIC\fR\fR .ad .sp .6 .RS 4n Numeric formatting information .RE .sp .ne 2 .mk .na \fB\fBLC_TIME\fR\fR .ad .sp .6 .RS 4n Time formatting information .RE .sp .ne 2 .mk .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 .mk .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 .mk .na \fB\fB/etc/inittab\fR\fR .ad .sp .6 .RS 4n Controls process dispatching by \fBinit\fR. .RE .sp .ne 2 .mk .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 .mk .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 .mk .na \fB\fB/var/adm/utmpx\fR\fR .ad .sp .6 .RS 4n User access and administration information. .RE .sp .ne 2 .mk .na \fB\fB/var/adm/wtmpx\fR\fR .ad .sp .6 .RS 4n History of user access and administration information. .RE .sp .ne 2 .mk .na \fB/var/run/initpipe\fR .ad .sp .6 .RS 4n A named pipe used for internal communication. .RE .SH SEE ALSO .sp .LP \fBlogin\fR(1), \fBsh\fR(1), \fBstty\fR(1), \fBwho\fR(1), \fBkernel\fR(1M), \fBshutdown\fR(1M), \fBsu\fR(1M), \fBsvc.configd\fR(1M), \fBsvc.startd\fR(1M), \fBttymon\fR(1M), \fBioctl\fR(2), \fBkill\fR(2), \fBctime\fR(3C), \fBpam\fR(3PAM), \fBinit.d\fR(4), \fBinittab\fR(4), \fBpam.conf\fR(4), \fBTIMEZONE\fR(4), \fButmpx\fR(4), \fBattributes\fR(5), \fBpam_unix_session\fR(5), \fBsmf\fR(5), \fBtermio\fR(7I) .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(4)) 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(5) module is no longer supported. Similar functionality is provided by \fBpam_unix_session\fR(5).