INIT(8) System Manager's Manual INIT(8)
init - process control initialization
/usr/etc/init [ -bs ]
init is invoked inside the operating system as the last step in the
boot procedure. It normally runs the sequence of commands in the
script /etc/rc.boot (see rc(8)) to check the file system. If passed
the -b option from the boot program, init skips this step. If the file
system check succeeds or is skipped, init runs the commands in /etc/rc
and /etc/rc.local to begin multiuser operation; otherwise it commences
single-user operation by giving the super-user a shell on the console.
It is possible to pass the -s parameter from the boot program to init
so that single-user operation is commenced immediately.
Whenever a single-user shell is created, and the system is running as a
secure system, the init program demands the super-user password. This
is to prevent an ordinary user from invoking a single-user shell and
thereby circumventing the system's security. Logging out (for
instance, by entering an EOT) causes init to proceed with a multi-user
boot. The super-user password is demanded whenever the system is run-
ning secure as determined by issecure(3), or the console terminal is
not labeled "secure" in /etc/ttytab.
Whenever single-user operation is terminated (for instance by killing
the single-user shell) init runs the scripts mentioned above.
In multi-user operation, init's role is to create a process for each
terminal port on which a user may log in. To begin such operations, it
reads the file /etc/ttytab and executes a command for each terminal
specified in the file. This command will usually be /usr/etc/getty.
getty(8) opens and initializes the terminal line, reads the user's name
and invokes login(1) to log in the user and execute the shell.
Ultimately the shell will terminate because it received EOF, either
explicitly, as a result of hanging up, or from the user logging out.
The main path of init, which has been waiting for such an event, wakes
up and removes the appropriate entry from the file /etc/utmp, which
records current users. init then makes an entry in /var/adm/wtmp,
which maintains a history of logins and logouts. The /var/adm/wtmp
entry is made only if a user logged in successfully on the line. Then
the appropriate terminal is reopened and the command for that terminal
init catches the hangup signal (SIGHUP) and interprets it to mean that
the file /etc/ttytab should be read again. The shell process on each
line which used to be active in /etc/ttytab but is no longer there is
terminated; a new process is created for each added line; lines
unchanged in the file are undisturbed. Thus it is possible to drop or
add terminal lines without rebooting the system by changing /etc/ttytab
and sending a hangup signal to the init process: use `kill -HUP 1'.
init terminates multi-user operations and resumes single-user mode if
sent a terminate (SIGTERM) signal: use `kill -TERM 1'. If there are
processes outstanding which are deadlocked (due to hardware or software
failure), init does not wait for them all to die (which might take for-
ever), but times out after 30 seconds and prints a warning message.
init ceases to create new processes, and allows the system to slowly
die away, when sent a terminal stop (SIGTSTP) signal: use
`kill -TSTP 1'. A later hangup will resume full multi-user operations,
or a terminate will initiate a single-user shell. This hook is used by
reboot(8) and halt(8).
Whenever it reads /etc/ttytab, init will normally write out an old-
style /etc/ttys file reflecting the contents of /etc/ttytab. This is
required in order that programs built on earlier versions of SunOS that
read the /etc/ttys file (for example, programs using the ttyslot(3V)
routine, such as shelltool (1)) may continue to run. If it is not
required that such programs run, /etc/ttys may be made a link (hard or
symbolic) to /etc/ttytab and init will not write to /etc/ttys.
init's role is so critical that if it dies, the system will reboot
itself automatically. If, at bootstrap time, the init program cannot
be located, the system will print an error message and panic.
kill(1), login(1), sh(1), shelltool(1), issecure(3), ttyslot(3V),
ttytab(5), getty(8), halt(8), rc(8), reboot(8), shutdown(8)
command failing, sleeping.
A process being started to service a line is exiting quickly
each time it is started. This is often caused by a ringing or
noisy terminal line. init will sleep for 30 seconds, then con-
tinue trying to start the process.
WARNING: Something is hung (won't die); ps axl advised.
A process is hung and could not be killed when the system was
shutting down. This is usually caused by a process which is
stuck in a device driver due to a persistent device error condi-
4th Berkeley Distribution 6 December 1988 INIT(8)