init
PURPOSE
Initializes the system.
SYNOPSIS
init
DESCRIPTION
After the kernel completes the basic processor initial-
ization, it starts a process that is the ancestor of all
other processes in the system. The process is init, the
program that controls the state in which the system is
running, normally either maintenance mode or multiuser
mode. It is the program from which all loggers and most
system demons are started.
When init starts up, it determines what the startup mode
should be based on information in the file
/etc/.init.state, or, if this file does not exist or is
unreadable, on an argument passed to it by the kernel.
The usual startup modes for init are:
maintenance Starts a shell on the console, but do
not start any other processes
(single-user mode).
multiuser Runs the command file /etc/rc and
spawn loggers on all enabled ports.
exec-program Runs the specified program.
MAINTENANCE MODE
The maintenance mode is used for system installation,
correcting problems on the file system using the fsck
command, and other operations requiring an inactive
system. There are three ways to bring the system up in
maintenance mode:
1. If the system is currently running in normal (multi-
user) mode, use the shutdown -m command to bring the
system down to maintenance mode (shutdown sends init
a sigint signal).
2. Start the system from the Installation/Maintenance
Diskette and specify the Maintenance Mode option from
the End System Management menu.
3. Edit the file /etc/.init.state such that it consists
of the character m. This causes the system to come
up in maintenance mode each time it is started up.
Maintenance mode starts a shell program with superuser
authority on the console. When you log off this shell by
pressing END OF FILE (Ctrl-D), init asks you if you want
to leave maintenance mode.
A response beginning with "n" or "N" indicates "no," and
init starts another shell on the console. Any processes
running in the background continue to run. Any other
response indicates "yes."
If the response is yes, init enters normal mode, as
described in the following section. It also asks if the
file system should be assumed to be clean. If you
believe this to be true (for example, you have run fsck
and corrected all problems), answer yes. Your answer
determines whether the rc command is run with an m or d
argument.
NORMAL MODE
After the normal startup of the system (either from
system startup or by leaving maintenance mode), init runs
the normal initialization command file /etc/rc. It
passes rc an argument of either m (normal startup, clean
root), or d (normal startup, dirty root). The latter is
the default argument if the startup is from maintenance
mode. rc is responsible for performing integrity checks,
doing any necessary cleanups, mounting the normal file
systems, enabling standard ports, and starting system
demons. If an error occurs during the running of this
command file (indicated by a nonzero return code), init
either forces a system restart by executing the reboot
system call or enters maintenance mode.
Once rc completes successfully, init starts logger proc-
esses (normally getty) on each enabled port. Whenever
someone ends a logger by logging off a port, init notes
the logout and starts a new logger on the port. Every-
thing init knows about enabling ports is contained in the
file /etc/portstatus, which is maintained by the penable
command. Through this file, you can enable new ports or
disable ports that were previously enabled. Whenever
init receives a sighup (hangup) signal, it rereads the
portstatus file to see if any changes of port status have
been requested.
init then reads the commands in the /etc/rc.ds file, if
that file exists. Typically, /etc/rc.ds contains com-
mands to start Distributed Services. Any commands that
are needed to run remote mounts should be placed in
/etc/rc.ds.
If, at any time after the system starts up normally, init
discovers that no ports are enabled or if init receives
an interrupt signal, it decides again on startup options.
Generally, this means init will go through normal
startup, assuming a dirty root.
ENVIRONMENTS
Because init is the ultimate ancestor of every process on
the system, its environment parameters are inherited by
every process. As part of its initialization sequence,
init reads the file /etc/environment and copies any
assignments found in that file into the environment
passed to all of its subprocesses. It treats umask dif-
ferently. If it is assigned a reasonable octal value,
init does a umask system call for the specified value,
rather than passing the value in the environment. Simi-
larly, if filesize is specified, init issues a ulimit
call with the given size as the argument.
FILES
/etc/utmp Record of logged-in users.
/usr/adm/wtmp Permanent login accounting file.
/etc/portstatus Enabled port status file.
/etc/rc Initialization command file.
/etc/environment System-wide environment variables.
RELATED INFORMATION
The following commands: "getty," "pstart, penable,
pshare, pdelay," "rc," and "shutdown."
The reboot and umask system calls and the portstatus file
in AIX Operating System Technical Reference.
The discussion of starting up the system in Managing the
AIX Operating System.