Init
Encyclopedia
init is a program for Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

-based computer operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s that spawn
Spawn (computing)
Spawn in computing refers to a function that loads and executes a new child process.The current process may or may not continue to execute asynchronously...

s all other processes. It runs as a daemon
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

 and typically has PID
Process identifier
In computing, the process identifier is a number used by most operating system kernels to uniquely identify a process...

 1. The boot loader starts the kernel
Kernel
-Computer science:* Kernel , the central component of most operating systems** The Linux kernel, from GNU/Linux operating systems** The Windows 9x kernel, used in Windows 95, 98 and ME...

 and the kernel starts init. If one were to delete init without a replacement, the system would encounter a kernel panic
Kernel panic
A kernel panic is an action taken by an operating system upon detecting an internal fatal error from which it cannot safely recover. The term is largely specific to Unix and Unix-like systems; for Microsoft Windows operating systems the equivalent term is "Bug check" .The kernel routines that...

 on the next reboot.

The functionality diverged, in Unix systems such as System III
UNIX System III
UNIX System III was a version of the Unix operating system released by AT&T's Unix Support Group . It was first released outside of Bell Labs in 1982. UNIX System III was a mix of various AT&T Unixes: PWB/UNIX 2.0, CB UNIX 3.0, UNIX/TS 3.0.1 and UNIX/32V...

 and System V
UNIX System V
Unix System V, commonly abbreviated SysV , is one of the first commercial versions of the Unix operating system. It was originally developed by American Telephone & Telegraph and first released in 1983. Four major versions of System V were released, termed Releases 1, 2, 3 and 4...

, from the functionality provided by the init in Research Unix
Research Unix
Research Unix is a term used to refer to versions of the Unix operating system for DEC PDP-7, PDP-11, VAX and Interdata 7/32 and 8/32 computers, developed in the Bell Labs Computing Science Research Center ....

 and its BSD
Berkeley Software Distribution
Berkeley Software Distribution is a Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995...

 derivatives. The usage on most Linux distribution
Linux distribution
A Linux distribution is a member of the family of Unix-like operating systems built on top of the Linux kernel. Such distributions are operating systems including a large collection of software applications such as word processors, spreadsheets, media players, and database applications...

s is compatible with System V, but some distributions, such as Arch
Arch Linux
Arch Linux is an independently developed, Linux-based operating system for i686 and x86-64 computers. It is composed predominantly of free and open source software, and supports community involvement....

, use a BSD-style and others, such as Gentoo
Gentoo Linux
Gentoo Linux is a computer operating system built on top of the Linux kernel and based on the Portage package management system. It is distributed as free and open source software. Unlike a conventional software distribution, the user compiles the source code locally according to their chosen...

, have their own customized version.

Several replacements for init have been written which attempt to address design limitations such as systemd
Systemd
systemd is a replacement for the System V init daemon for Linux. It is intended to provide a better framework for expressing services' dependencies, allow more work to be done in parallel at system startup, and to reduce shell overhead....

 or Upstart
Upstart
Upstart is an event-based replacement for the traditional init daemon — the method by which several Unix-like computer operating systems perform tasks when the computer is started. It was written by Scott James Remnant, a former employee of Canonical Ltd....

, used by Ubuntu
Ubuntu (operating system)
Ubuntu is a computer operating system based on the Debian Linux distribution and distributed as free and open source software. It is named after the Southern African philosophy of Ubuntu...

 and some other Linux distributions.

SysV-style

System V init examines the /etc/inittab file for an :initdefault: entry, which tells init whether there is a default runlevel
Runlevel
The term runlevel refers to a mode of operation in one of the computer operating systems that implement Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six; though up to ten, from zero to nine, may be used. S is sometimes used as a synonym for one...

. If there is no default runlevel, then the user is dumped to a system console, where a runlevel must be entered manually.

Runlevels

The runlevel
Runlevel
The term runlevel refers to a mode of operation in one of the computer operating systems that implement Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six; though up to ten, from zero to nine, may be used. S is sometimes used as a synonym for one...

s in System V
UNIX System V
Unix System V, commonly abbreviated SysV , is one of the first commercial versions of the Unix operating system. It was originally developed by American Telephone & Telegraph and first released in 1983. Four major versions of System V were released, termed Releases 1, 2, 3 and 4...

 describe certain states of a machine, characterized by the processes run. There are generally 8 runlevels. These are the runlevels 0 to 6 and S or s, which are aliased to the same runlevel. Of these eight, 3 are so-called "reserved" runlevels:
0. Halt
1. Single user mode
Single user mode
Single user mode is a mode in which a multiuser computer operating system boots into a single superuser. It is mainly used for maintenance of multi-user environments such as network servers. Some tasks may require exclusive access to shared resources, for example running fsck on a network share...

6. Reboot


Aside from runlevels 0, 1, and 6, every Unix and Unix-like system treats runlevels a little differently. The common denominator is the /etc/inittab file, which defines what each runlevel does (if they do anything at all).

Default runlevels

Operating System Default runlevel
AIX
AIX operating system
AIX AIX AIX (Advanced Interactive eXecutive, pronounced "a i ex" is a series of proprietary Unix operating systems developed and sold by IBM for several of its computer platforms...

2
Arch Linux
Arch Linux
Arch Linux is an independently developed, Linux-based operating system for i686 and x86-64 computers. It is composed predominantly of free and open source software, and supports community involvement....

3
CentOS
CentOS
CentOS is a free operating system based on Red Hat Enterprise Linux . It exists to provide a free enterprise class computing platform and strives to maintain 100% binary compatibility with its upstream distribution...

3 or 5
Debian
Debian
Debian is a computer operating system composed of software packages released as free and open source software primarily under the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential...

2
Gentoo Linux
Gentoo Linux
Gentoo Linux is a computer operating system built on top of the Linux kernel and based on the Portage package management system. It is distributed as free and open source software. Unlike a conventional software distribution, the user compiles the source code locally according to their chosen...

3
HP-UX
HP-UX
HP-UX is Hewlett-Packard's proprietary implementation of the Unix operating system, based on UNIX System V and first released in 1984...

3
Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

3
Mandriva Linux
Mandriva Linux
Mandriva Linux is a Linux distribution distributed by Mandriva. It uses the RPM Package Manager...

5
Red Hat Linux
Red Hat Linux
Red Hat Linux, assembled by the company Red Hat, was a popular Linux based operating system until its discontinuation in 2004.Red Hat Linux 1.0 was released on November 3, 1994...

 / Fedora Core
Fedora (operating system)
Fedora is a RPM-based, general purpose collection of software, including an operating system based on the Linux kernel, developed by the community-supported Fedora Project and sponsored by Red Hat...

3 or 5
Slackware Linux 3
Solaris
Solaris Operating System
Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010....

3
SUSE Linux 5
Ubuntu (Server and Desktop)
Ubuntu (operating system)
Ubuntu is a computer operating system based on the Debian Linux distribution and distributed as free and open source software. It is named after the Southern African philosophy of Ubuntu...

2


On the Linux distributions defaulting to runlevel 5 in the table above, runlevel 5 is a multiuser graphical environment running the X Window System
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

, usually with a display manager. However, in the Solaris
Solaris Operating System
Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010....

 operating system, runlevel 5 is typically reserved to shut down and automatically power off the machine.

On most systems users can check the current runlevel with either of the following commands:
$ runlevel
$ who
Who (Unix)
The standard Unix command who displays a list of users who are currently logged into a computer.The who command is related to the command w, which provides the same information but also displays additional data and statistics.- Specification :...

 -r


The current runlevel is typically changed by root
Superuser
On many computer operating systems, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator or supervisor....

 running the telinit or init commands. The default runlevel is set in the /etc/inittab file with the :initdefault: entry.

BSD-style

BSD
Berkeley Software Distribution
Berkeley Software Distribution is a Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995...

 init runs the initialization shell script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

 located in /etc/rc, then launches getty
Getty (Unix)
getty, short for "get teletype", is a Unix program running on a host computer that manages physical or virtual terminals . When it detects a connection, it prompts for a username and runs the 'login' program to authenticate the user....

 on text-based terminals or a windowing system
Windowing system
A windowing system is a component of a graphical user interface , and more specifically of a desktop environment, which supports the implementation of window managers, and provides basic support for graphics hardware, pointing devices such as mice, and keyboards...

 such as X
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

 on graphical terminals under the control of /etc/ttys. There are no runlevels; the /etc/rc file determines what programs are run by init. The advantage of this system is that it is simple and easy to edit manually. However, new software added to the system may require changes to existing files that risk producing an unbootable system. To mitigate against this, BSD variants have long supported a site-specific /etc/rc.local file that is run in a sub-shell near the end of the boot sequence.

A fully modular system was introduced with NetBSD
NetBSD
NetBSD is a freely available open source version of the Berkeley Software Distribution Unix operating system. It was the second open source BSD descendant to be formally released, after 386BSD, and continues to be actively developed. The NetBSD project is primarily focused on high quality design,...

 1.5 and ported to FreeBSD
FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...

 5.0 and successors. This system executes scripts in the /etc/rc.d directory. Unlike System V's script ordering, which is derived from the filename of each script, this system uses explicit dependency tags placed within each script. The order in which scripts are executed is determined by the rcorder script based on the requirements stated in these tags.

Replacements for init

Various efforts have been made to replace the traditional init daemons with something better, including:
  • BootScripts in GoboLinux
    GoboLinux
    GoboLinux is a free and open source operating system whose most prominent feature is a reorganization of the traditional Linux file system. Rather than following the Filesystem Hierarchy Standard like most Unix-like systems, each program in a GoboLinux system has its own subdirectory tree, where...

  • DEMONS, a modification of the init start process by KahelOS
    KahelOS
    KahelOS is a Linux distribution based on Arch Linux. It uses Arch Linux's pacman package manager and is a rolling release. It comes with a ready to install GNOME environment....

    , where daemons are started only when the DE (desktop environment) started.
  • eINIT
    EINIT
    eINIT is a replacement for sysvinit, an init system used on Unix-based operating systems. eINIT is designed with speed in mind. Many testers claim that their systems boot up in 30 seconds, whereas sysvinit takes around two minutes to boot....

    , a full replacement of init designed to start processes asynchronously, but with the potential of doing it without shell-scripts
  • Initng
    Initng
    Initng is a full replacement of the UNIX System V init, the first process spawned by the kernel in Unix-like computer operating systems, which is responsible for the initialization of every other process...

    , a full replacement of init designed to start processes asynchronously
  • launchd
    Launchd
    launchd is a unified, open-source service management framework for starting, stopping and managing daemons, applications, processes, and scripts...

    , a replacement for init introduced in Mac OS X v10.4
    Mac OS X v10.4
    Mac OS X v10.4 Tiger is the fifth major release of Mac OS X, Apple's desktop and server operating system for Macintosh computers. Tiger was released to the public on 29 April 2005 for US$129.95 as the successor to Mac OS X Panther , which had been released 18 months earlier...

     (it launches SystemStarter to run old-style 'rc.local' and SystemStarter processes)
  • Mudur, an init replacement written in Python
    Python (programming language)
    Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

     and designed to start process asynchronously in use by the Pardus
    Pardus (operating system)
    Pardus is a Linux distribution developed with support from the Turkish government. Pardus’ main focus is office-related work, including the use in Turkish government agencies. Despite that, Pardus ships in several languages. Its ease of use and availability free of charge spawned numerous...

     Linux distribution.
  • OpenRC, the default init system for Gentoo Linux
    Gentoo Linux
    Gentoo Linux is a computer operating system built on top of the Linux kernel and based on the Portage package management system. It is distributed as free and open source software. Unlike a conventional software distribution, the user compiles the source code locally according to their chosen...

  • runit
    Runit
    runit is an implementation of Process Supervision for Linux....

    , a cross-platform
    Cross-platform
    In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

     full replacement for init with parallel starting of services
  • Service Management Facility
    Service Management Facility
    Service Management Facility is a feature of the Solaris operating system that creates a supported, unified model for services and service management on each Solaris system and replaces init.d scripts. SMF introduces:...

    , a complete full replacement/redesign of init from the ground up in Solaris
    Solaris Operating System
    Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010....

     starting with Solaris 10
  • systemd
    Systemd
    systemd is a replacement for the System V init daemon for Linux. It is intended to provide a better framework for expressing services' dependencies, allow more work to be done in parallel at system startup, and to reduce shell overhead....

    , a full replacement for init with parallel starting of services, reduced shell overhead and other features, used by Fedora 15.
  • SystemStarter
    SystemStarter
    SystemStarter is a system program in Mac OS X, started by Mac OS X's BSD-style init prior to Mac OS X v10.4 and by launchd in Mac OS X v10.4 and later releases, that starts system processes specified by a set of property lists. SystemStarter was originally written by Wilfredo Sanchez for Mac OS X...

    , a process spawner started by the BSD-style init in Mac OS X
    Mac OS X
    Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

     prior to Mac OS X v10.4
    Mac OS X v10.4
    Mac OS X v10.4 Tiger is the fifth major release of Mac OS X, Apple's desktop and server operating system for Macintosh computers. Tiger was released to the public on 29 April 2005 for US$129.95 as the successor to Mac OS X Panther , which had been released 18 months earlier...

  • Upstart
    Upstart
    Upstart is an event-based replacement for the traditional init daemon — the method by which several Unix-like computer operating systems perform tasks when the computer is started. It was written by Scott James Remnant, a former employee of Canonical Ltd....

    , a full replacement of init designed to start processes asynchronously initiated by Ubuntu
    Ubuntu (operating system)
    Ubuntu is a computer operating system based on the Debian Linux distribution and distributed as free and open source software. It is named after the Southern African philosophy of Ubuntu...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK