INIT(8)

NAME
init, telinit — process control initialization

SYNOPSIS
/etc/init [0-9A-Za-z...]
/etc/telinit [0-9A-Za-z...]

DESCRIPTION
Init is a process spawner and manager. Its primary role is to create processes according to information stored in the file /etc/inittab [see inittab(5)].

Init is the first and only process started by the kernel when the system is booted. Init is responsible for configuring the system for use and starting processes to watch for user logins.

At any given time, the system will be in one of 12 possible run levels, 0–9 or S or s (run levels S and s are identical). A run level is a software configuration of the system under which a selected group of processes exist. The group of processes for a particular run level are defined by entries in the /etc/inittab file.

Run levels may be given meaningful names using special entries in /etc/inittab. It is then possible to refer to run levels using these names rather than single characters.

The run level is changed by having a privileged user run /etc/telinit, which sends appropriate signals to the original init spawned by the operating system when the system was booted, telling it which run level to change to.

The following run levels are commonly defined as follows:

0   shut the machine down so it is safe to remove power.

1   bring the system down to single-user mode. All file systems except root are unmounted. All user processes are killed and a single-user login is presented on the console.

2   bring the system to basic multi-user mode. Processes are started to watch for user logins on local serial ports.

3   configure and start the TCP/IP networking services. Allows access both to and from other systems via the network.

4   configure and start the NFS networking services. Remote file systems may be mounted from other systems running NFS. Local file systems may be exported to other systems running NFS. Any NFS file systems listed in /etc/fstab are automatically mounted on entering this run level.

5   the system is brought fully multiuser with all networking services present, X windows is started and xdm [see xdm(x)] is used to present a login window on the console. This is normally the default.

Q,q re-examine /etc/inittab.

S,s enter single-user mode. All mounted file systems remain mounted. Only processes spawned by init are killed.

When a Linux system is booted, init is started as the final step of kernel initialisation. Init reads the file /etc/inittab and spawns processes for each entry of type sysinit in turn. These entries perform the initial software initialisation of the system. Having run the sysinit processes, init looks for an initdefault entry in B/etc/inittab. This determines the initial run level that the system will start in. If no initdefault entry is found, init will default to single-user mode (run level S). The initial run level defined in /etc/inittab may be overridden by specifying a run level or run level name on the boot command line.

If this is the first time since power up that init has entered a run level other than single-user, init first scans /etc/inittab and runs entries of types boot and bootwait. These entries perform special initialisation of the system, such as mounting file systems, before users are allowed onto the system. Init then executes all other processes for the run level as normal.

Each time a child terminates, init records the fact and the reason it died in /etc/utmp and /etc/wtmp if these files exist.

When a run level change request is made, init sends a notification signal SIGTERM to all processes that are not defined in the target run level. It then waits 5 seconds and sends a warning signal SIGINT to the processes, waits another 2 seconds and then forcibly terminates them using the kill signal SIGKILL.

Telinit, which is linked to init is used to direct the actions of init. It takes either a one character run level argument or a run level name defined in the inittab and signals init to take the appropriate action.

DIAGNOSTICS
If /etc/init finds that it is continuously respawning an entry more than 10 times in 2 minutes, it will assume that there is an error in the command string, and generate an error message on the system console. It will then refuse to respawn this entry until the inittab is reread. This prevents it from eating up system resources when someone makes a typographical error in the /etc/inittab file or the program for the entry is removed.

NOTES
Init and telinit can only be run by someone who has super-user privileges.

KNOWN DIFFERENCES FROM SYSV INIT

Standard SYSV only allows run levels 0-6 and S plus demand states a, b and c. This init allows any digit or S as a run level plus any other single character as a demand state. Upper and lower case letters are treated as being identical as with SYSV. Furthermore this init allows names to be assigned to run levels using special entries in inittab. These names may be used as arguments to init and telinit where a run level would normally be used. These are extensions of SYSV usage and do not compromise compatibility.

Standard SYSV claims that init sets the tty modes on the console when entering single user mode and resets them when exiting single user mode. This init doesn't. It expects the single user process to do whatever is necessary.

When changing run level standard SYSV init first warns processes with SIGTERM, pauses 5 seconds and then kills them with SIGKILL. This init adds a second warning. The sequence is SIGTERM, pause 5 seconds, SIGINT, pause 2 seconds, SIGKILL.

Standard SYSV only executes powerfail and powerwait inittab entries defined in the single user mode S. This restriction does not exist in this init.

Under standard SYSV the terminal that executed a telinit S becomes the system console when single user mode is reached. This isn't (yet) implemented in this version of init.

FILES
/etc/inittab
/etc/utmp
/etc/wtmp

SEE ALSO
getty(1), login(1), sh(1), who(1), kill(2), inittab(5), utmp(5).

AUTHOR
Mike Jagdis, jaggy@purplet.demon.co.uk

STANDARDS CONFORMANCE
Init is not conformant with AT&T SVID Issue 2 but is intended to provide a reasonable superset of conformant behaviour for Linux.