INIT(8) | Maintenance Commands and Procedures | INIT(8) |
init, telinit - process control initialization
/sbin/init [0123456abcQqSs]
/etc/telinit [0123456abcQqSs]
init 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 kernel(8)). init initiates the core components of the service management facility, svc.configd(8) and svc.startd(8), and restarts these components if they fail. For backwards compatibility, init also starts and restarts general processes according to /etc/inittab, as desribed below.
The run levels and system booting descriptions given below are provided for compatibility purposes only, and otherwise made obsolete by the service management facility, smf(7).
If init exits for any reason other than system shutdown, it will be restarted with process-ID 1.
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 init for each of these run levels are defined in /etc/inittab. init can be in one of eight run levels, 0−6 and S or s (S and s are identical). The run level changes when a privileged user runs /sbin/init.
When the system is booted, init is invoked and the following occurs. First, it reads /etc/default/init to set environment variables. This is typically where TZ (time zone) and locale-related environments such as LANG or LC_CTYPE get set. (See the FILES section at the end of this page.) init then looks in /etc/inittab for the initdefault entry (see inittab(5)). If the initdefault entry:
exists
does not exist
The initdefault entry in /etc/inittab corresponds to the following run levels:
S or s
0-6
If this is the first time since power up that init has entered a run level other than single-user state, init first scans /etc/inittab for boot and bootwait entries (see inittab(5)). These entries are performed before any other processing of /etc/inittab 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. init then scans /etc/inittab and executes all other entries that are to be processed for that run level.
To spawn each process in /etc/inittab, init 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 /etc/inittab, init waits for one of its descendant processes to die, a powerfail signal, or a signal from another init or telinit process to change the system's run level. When one of these conditions occurs, init re-examines /etc/inittab.
New entries can be added to /etc/inittab at any time; however, init still waits for one of the above three conditions to occur before re-examining /etc/inittab. To get around this, init Q or init q command wakes init to re-examine /etc/inittab immediately.
When init comes up at boot time and whenever the system changes from the single-user state to another run state, init sets the ioctl(2) states of the console to those modes saved in the file /etc/ioctl.syscon. init writes this file whenever the single-user state is entered.
When a run level change request is made, init or a designate sends the warning signal (SIGTERM) to all processes that are undefined in the target run level. A minimum interval of five seconds is observed before init or its designate forcibly terminates these processes by sending a kill signal (SIGKILL). Additionally, init informs svc.startd(8) that the run level is changing. svc.startd(8) then restricts the system to the set of services which the milestone corresponding to the run-level change depends on.
When init receives a signal telling it that a process it spawned has died, it records the fact and the reason it died in /var/adm/utmpx and /var/adm/wtmpx if it exists (see who(1)). A history of the processes spawned is kept in /var/adm/wtmpx.
If init receives a powerfail signal (SIGPWR) it scans /etc/inittab for special entries of the type powerfail and powerwait. These entries are invoked (if the run levels permit) before any further processing takes place. In this way init can perform various cleanup and recording functions during the powerdown of the operating system.
You can set default values for environment variables, for such items as timezone and character formatting, in /etc/default/init. See the FILES section, below, for a list of these variables.
telinit, which is linked to /sbin/init, is used to direct the actions of init. It takes a one-character argument and signals init to take the appropriate action.
init uses pam(3PAM) for session management. The PAM configuration policy, listed through /etc/pam.conf, specifies the session management module to be used for init. Here is a partial pam.conf file with entries for init using the UNIX session management module.
init session required pam_unix_session.so.1
If there are no entries for the init service, then the entries for the "other" service will be used.
0
1
This request corresponds to a request for smf(7) to restrict the system milestone to svc:/milestone/single-user:default.
2
This request corresponds to a request for smf(7) to restrict the system milestone to svc:/milestone/multi-user:default.
3
This request corresponds to a request for smf(7) to restrict the system milestone to svc:/milestone/multi-user-server:default.
4
5
6
On x86 systems, service svc:/system/boot-config:default is enabled by default. When the config/fastreboot_default property is set to true, init 6 will bypass the firmware.
a,b,c
Q,q
S, s
This request corresponds to a request for smf(7) to restrict the system milestone to svc:/milestone/single-user:default.
/dev/console
/etc/default/init
TZ
Refer to the TIMEZONE(5) man page before changing this setting.
CMASK
LC_CTYPE
LC_MESSAGES
LC_MONETARY
LC_NUMERIC
LC_TIME
LC_ALL
LANG
/etc/inittab
/etc/ioctl.syscon
/etc/svc/volatile/init.state
/var/adm/utmpx
/var/adm/wtmpx
/var/run/initpipe
login(1), sh(1), stty(1), who(1), ioctl(2), kill(2), ctime(3C), pam(3PAM), termio(4I), TIMEZONE(5), init.d(5), inittab(5), pam.conf(5), utmpx(5), attributes(7), pam_unix_session(7), smf(7), kernel(8), shutdown(8), su(8), svc.configd(8), svc.startd(8), ttymon(8)
If init finds that it is respawning an entry from /etc/inittab 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 init or telinit command. This prevents init from eating up system resources when someone makes a typographical error in the inittab file, or a program is removed that is referenced in /etc/inittab.
init and telinit can be run only by a privileged user.
The S or s state must not be used indiscriminately in /etc/inittab. When modifying this file, it is best to avoid adding this state to any line other than initdefault.
If a default state is not specified in the initdefault entry in /etc/inittab, state 6 is entered. Consequently, the system will loop by going to firmware and rebooting continuously.
If the utmpx file cannot be created when booting the system, the system will boot to state "s" regardless of the state specified in the initdefault entry in /etc/inittab. This can occur if the /var file system is not accessible.
When a system transitions down to the S or s state, the /etc/nologin file (see nologin(5)) is created. Upon subsequent transition to run level 2, this file is removed.
init uses /var/run/initpipe, a named pipe, for internal communication.
The pam_unix(7) module is no longer supported. Similar functionality is provided by pam_unix_session(7).
September 2, 2009 | OmniOS |