Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Init
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|UNIX system component}} {{About|the Unix process||INIT (disambiguation)}} {{Primary sources|date=December 2020}} {{Lowercase title}} [[File:Version 7 UNIX SIMH PDP11 Etc.png|thumb|[[Version 7 Unix]]: {{mono|/etc}} listing, showing {{mono|init}} and {{mono|rc}}]] [[File:Version 7 UNIX SIMH PDP11 Etc Rc.png|thumb|Version 7 Unix: contents of an {{mono|/etc/rc}} [[Bourne shell]] script]] In [[Unix]]-based computer [[operating system]]s, '''init''' (short for ''initialization'') is the first [[process (computer science)|process]] started during [[booting]] of the operating system. Init is a [[daemon (computing)|daemon]] process that continues running until the system is shut down. It is the direct or indirect [[parent process|ancestor]] of all other processes and automatically adopts all [[orphan process|orphaned processes]]. Init is started by the [[kernel (operating system)|kernel]] during the [[booting]] process; a [[kernel panic]] will occur if the kernel is unable to start it, or it should die for any reason. Init is typically assigned [[process identifier]] 1. In Unix systems such as [[UNIX System III|System III]] and [[UNIX System V|System V]], the design of init has diverged from the functionality provided by the init in [[Research Unix]] and its [[Berkeley Software Distribution|BSD]] derivatives. Up until the early 2010s,<ref>{{Cite web |date=2018-11-08 |title=Lennart Poettering on systemd's Tumultuous Ascendancy |website=The New Stack |url=https://thenewstack.io/unix-greatest-inspiration-behind-systemd/ |access-date=2024-01-30 |archive-url=https://web.archive.org/web/20181108025744/https://thenewstack.io/unix-greatest-inspiration-behind-systemd/ |archive-date=2018-11-08 |url-status=live}}</ref>{{failed verification|date=February 2024}} most [[Linux distribution]]s employed a traditional init that was somewhat compatible with System V, while some distributions such as [[Slackware Linux|Slackware]] use BSD-style startup scripts, and other distributions such as [[Gentoo Linux|Gentoo]] have their own customized versions. Since then, several additional init implementations have been created, attempting to address design limitations in the traditional versions. These include [[launchd]], the [[Service Management Facility]], [[systemd]], [[Runit]] and [[OpenRC]]. == {{Anchor|STARTUP-SCRIPTS}}Research Unix-style/BSD-style == [[Research Unix]] init runs the initialization [[shell script]] located at <code>/etc/rc</code>,<ref>{{man|8|init|v7}}</ref> then launches [[getty (Unix)|getty]] on terminals under the control of <code>/etc/ttys</code>.<ref>{{man|5|ttys|v7}}</ref> There are no runlevels; the <code>/etc/rc</code> 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. [[Berkeley Software Distribution|BSD]] init was, prior to 4.3BSD, the same as Research UNIX's init;<ref>{{man|8|init|4.2BSD}}</ref><ref>{{man|5|ttys|4.2BSD}}</ref> in [[4.3BSD]], it added support for running a [[windowing system]] such as [[X Window System|X]] on graphical terminals under the control of <code>/etc/ttys</code>.<ref>{{man|8|init|4.3BSD}}</ref><ref>{{man|5|ttys|4.3BSD}}</ref> To remove the requirement to edit <code>/etc/rc</code>, BSD variants have long supported a site-specific <code>/etc/rc.local</code> file that is run in a sub-shell near the end of the boot sequence. A fully modular system was introduced with [[NetBSD]] 1.5 and ported to [[FreeBSD]] 5.0 and successors. This system executes scripts in the <code>/etc/rc.d</code> 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.<ref>{{cite web | url = http://aplawrence.com/Basics/unix-startup-scripts-2.html | title = Unix and Linux startup scripts, Part 2 | author = Andrew Smallshaw | date = 7 December 2009 | access-date = 6 June 2011 | archive-date = 18 December 2009 | archive-url = https://web.archive.org/web/20091218083059/http://aplawrence.com/Basics/unix-startup-scripts-2.html | url-status = live }}</ref> The order in which scripts are executed is determined by the ''rcorder'' utility based on the requirements stated in these tags. == {{Anchor|SYSV}}SysV-style == [[File:Sysv-rc-conf.png|thumb|{{Mono|sysv-rc-conf}}, a [[Text-based user interface|TUI]] utility that selects which SysV-style init scripts will be run in each runlevel]] When compared to its predecessors, AT&T's [[UNIX System III]] introduced a new style of system startup configuration,<ref>{{cite web|url=http://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII%2Fusr%2Fsrc%2Fman%2Fman8%2Finit.8|title=init(8)|work=minnie.tuhs.org|access-date=2015-09-12|archive-date=2021-07-27|archive-url=https://web.archive.org/web/20210727193510/https://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII%2Fusr%2Fsrc%2Fman%2Fman8%2Finit.8|url-status=live}}</ref> which survived (with modifications) into [[UNIX System V]] and is therefore called the "SysV-style init". At any moment, a running System V is in one of the predetermined number of states, called ''[[runlevel]]s''. At least one runlevel is the normal operating state of the system; typically, other runlevels represent single-user mode (used for repairing a faulty system), system shutdown, and various other states. Switching from one runlevel to another causes a per-runlevel set of scripts to be run, which typically mount filesystems, start or stop [[daemon (Unix)|daemons]], start or stop the [[X Window System]], shutdown the machine, etc. === Runlevels === {{Details|Runlevel}} The [[runlevel]]s in System V describe certain states of a machine, characterized by the processes and daemons running in each of them. In general, there are seven runlevels, out of which three runlevels are considered "standard", as they are essential to the operation of a system: {{ordered list |item1_value=0 | [[Shutdown (computing)|Turn off]] |item2_value=1 | [[Single-user mode]] (also known as ''S'' or ''s'') |item3_value=6 | [[Reboot (computing)|Reboot]] }} Aside from these standard ones, Unix and Unix-like systems treat runlevels somewhat differently. The common denominator, the <code>/etc/inittab</code> file, defines what each configured runlevel does in a given system. === Default runlevels === {| class="wikitable floatright sortable" style="margin-left: 1.5em;" |- ! Operating system ! Default runlevel |- | [[AIX operating system|AIX]] | 5 |- | [[antiX]] | 2 |- | [[Gentoo Linux]] | 3<ref>{{cite web |url=https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts |title=Initscripts |work=Gentoo Linux Documentation |publisher=Gentoo.org |date=2014-12-13 |access-date=2020-12-08 |archive-date=2020-12-03 |archive-url=https://web.archive.org/web/20201203013811/https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts |url-status=live }}</ref> |- | [[HP-UX]] | 3 (console/server/multiuser) or 4 (graphical) |- | [[Linux From Scratch]] | 3 |- |- | [[Slackware Linux]] | 3 |- | [[Solaris (operating system)|Solaris]] / [[illumos]] | 3<ref>{{cite web |url=https://docs.oracle.com/cd/E23824_01/html/821-1451/hbrunlevels-13026.html |title=Run Levels |publisher=[[Oracle Corporation|Oracle]] |work=Oracle Solaris Administration: Common Tasks |access-date=2017-11-14 |archive-date=2016-04-10 |archive-url=https://web.archive.org/web/20160410084238/http://docs.oracle.com/cd/E23824_01/html/821-1451/hbrunlevels-13026.html |url-status=live }}</ref> |- | [[UNIX System V]] Releases 3.x, 4.x | 2 |- | [[UnixWare]] 7.x | 3 |} On Linux distributions defaulting to runlevel 10 in the table on the right, runlevel 10 invokes a multiuser graphical environment running the [[X Window System]], usually with a [[X display manager (program type)|display manager]] like [[GNOME Display Manager|GDM]] or [[KDE Display Manager|KDM]]. However, the [[Solaris (operating system)|Solaris]] and [[illumos]] operating systems typically reserve runlevel 10 to shut down and automatically power off the machine. On most systems, all users can check the current runlevel with either the <code>runlevel</code> or <code>[[who (Unix)|who]] -r</code> command.<ref>{{cite web |url=http://unixhelp.ed.ac.uk/CGI/man-cgi?runlevel+8 |title=UNIX man pages : runlevel (8) |publisher=Unixhelp.ed.ac.uk |date=1997-05-27 |access-date=2014-07-12 |archive-url=https://web.archive.org/web/20140714112953/http://unixhelp.ed.ac.uk/CGI/man-cgi?runlevel+8 |archive-date=2014-07-14 |url-status=dead }}</ref> The [[superuser|root]] user typically changes the current runlevel by running the <code>telinit</code> or <code>init</code> commands. The <code>/etc/inittab</code> file sets the default runlevel with the <code>:initdefault:</code> entry. On Unix systems, changing the runlevel is achieved by starting only the missing services (as each level defines only those that are started / stopped).{{Citation needed|date=May 2013}} For example, changing a system from runlevel 3 to 4 might only start the local X server. Going back to runlevel 3, it would be stopped again. == {{Anchor|S6}}Other implementations == Traditionally, one of the major drawbacks of init is that it starts tasks serially, waiting for each to finish loading before moving on to the next. When startup processes end up [[Input/output]] (I/O) blocked, this can result in long delays during boot. Speeding up I/O, e.g. by using SSDs, may shorten the delays but it does not address the root cause. Various efforts have been made to replace the traditional init daemons to address this and other design problems, including: * [[GoboLinux#Boot system|BootScripts]] in [[GoboLinux]] * [[Busybox|busybox-init]], suited to [[embedded operating system]]s, used by [[Alpine Linux]] (before being replaced with [[OpenRC]]), [[SliTaz]] 5 (Rolling), [[Tiny Core Linux]], and [[VMware ESXi]], and used by [[OpenWrt]] before it was replaced with [[OpenWrt#procd|procd]] * Dinit, a service manager and init system.<ref>{{cite web |url=https://github.com/davmac314/dinit |title=GitHub - davmac314/dinit: Service monitoring / "init" system |website=[[GitHub]] |access-date=2021-12-12 |archive-date=2021-12-12 |archive-url=https://web.archive.org/web/20211212163253/https://github.com/davmac314/dinit |url-status=live }}</ref> * [[Epoch (init system)|Epoch]], a single-threaded Linux init system focused on simplicity and service management<ref>{{cite web |url=http://universe2.us/epoch.html |title=Epoch Init System Homepage |access-date=2014-07-31 |archive-date=2014-08-02 |archive-url=https://web.archive.org/web/20140802142947/http://universe2.us/epoch.html |url-status=live }}</ref> * [[ginitd]], a software package that consists of an init system and a service management system<ref>{{Cite web |last=Wood-Mattheusson |first=S. M. |date=2024-12-16 |title=ginitd: det effektivaste init-systemet |url=https://ylur.me/gershwin/ginitd }}</ref> * [[Initng]], a full replacement of init designed to start processes asynchronously * [[launchd]], a replacement for init in [[Darwin (operating system)|Darwin]]/[[macOS]]/[[iOS]]/[[tvOS]] starting with [[Mac OS X v10.4]] (it launches SystemStarter to run old-style <nowiki>'rc.local'</nowiki> and SystemStarter processes) * [[OpenRC]], a process spawner that utilizes system-provided init, while providing process isolation, parallelized startup, and service dependency; used by [[Alpine Linux]], [[Gentoo Linux|Gentoo]] and its derivatives, and available as an option in [[Devuan]] and [[Artix Linux]]. * [[runit]], a cross-platform full replacement for init with parallel starting of services, used by default in [[Void Linux]]<ref>{{Cite web |url=http://voidlinux.org/ |title=Void Linux main page |access-date=2020-08-31 |archive-date=2020-08-29 |archive-url=https://web.archive.org/web/20200829154800/https://voidlinux.org/ |url-status=live }}</ref> * Sun [[Service Management Facility]] (SMF), a complete replacement/redesign of init from the ground up in [[illumos]]/[[Solaris (operating system)|Solaris]] starting with Solaris 10, but launched as the only service by the original System V-style init * [[GNU Guix System#GNU Shepherd init system|Shepherd]], the [[GNU]] service and daemon manager which provides asynchronous, dependency-based initialisation; written in [[Guile (programming language)|Guile Scheme]] and meant to be interactively hackable during normal system operation<ref>{{cite web |url=https://www.gnu.org/software/shepherd/ |title=The Shepherd - GNU Project |publisher=Free Software Foundation, Inc. |access-date=2016-01-16 |archive-date=2016-02-12 |archive-url=https://web.archive.org/web/20160212224150/https://www.gnu.org/software/shepherd/ |url-status=live }}</ref> * [[S6 (software)|s6]], a software suite that includes an init system. <ref>{{cite web |url=https://www.skarnet.org/software/s6/why.html |title=s6: why another supervision suite |access-date=2021-09-13 |archive-date=2021-09-13 |archive-url=https://web.archive.org/web/20210913201711/https://skarnet.org/software/s6/why.html |url-status=live }}</ref><ref>{{cite web |url=https://www.linuxquestions.org/questions/slackware-14/s6-init-system-4175658553/ |url-status=dead |archive-url=https://web.archive.org/web/20210913201707/https://www.linuxquestions.org/questions/slackware-14/s6-init-system-4175658553/ |archive-date=2021-09-13 |title=s6 init system}}</ref> * [[systemd]], a software suite, full replacement for init in Linux that includes an init daemon, with concurrent starting of services, service manager, and other features. Used by [[Debian]] (replaces SysV init) and [[Ubuntu]], among other popular Linux distributions. * [[SystemStarter]], a process spawner started by the BSD-style init in [[Mac OS X]] prior to Mac OS X v10.4 * [[Upstart (software)|Upstart]], a full replacement of init designed to start processes asynchronously. Initiated by [[Ubuntu (operating system)|Ubuntu]] and used by them until 2014. It was also used in Fedora 9,<ref>{{citation |url=https://fedoraproject.org/wiki/Releases/14/FeatureList |title=Fedora 14 Accepted Features |date=2010-07-13 |access-date=2010-07-13 |archive-date=2022-03-27 |archive-url=https://web.archive.org/web/20220327191742/https://fedoraproject.org/wiki/Releases/14/FeatureList |url-status=live }}</ref><ref>{{cite web |url=https://lwn.net/Articles/405100/ |title=Fedora defers systemd to F15 |date=2010-09-14 |access-date=2010-09-17 |publisher=Linux Weekly News |archive-date=2010-09-19 |archive-url=https://web.archive.org/web/20100919142259/http://lwn.net/Articles/405100/ |url-status=live }}</ref> Red Hat Enterprise Linux 6<ref>{{cite web |url=https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/6.0_technical_notes/deployment |publisher=[[Red Hat]] |title=Deployment |work=Red Hat Enterprise Linux 6: Technical Notes |access-date=2013-12-31 |archive-date=2018-08-29 |archive-url=https://web.archive.org/web/20180829175441/https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/6.0_technical_notes/deployment |url-status=live }}</ref> and [[Google]]'s [[ChromeOS]].<ref name="chrome-os">{{citation |url=https://sites.google.com/a/chromium.org/dev/chromium-os/chromiumos-design-docs/software-architecture |title=Software Architecture: Chromium OS design documents |access-date=25 January 2014 |archive-date=9 April 2022 |archive-url=https://web.archive.org/web/20220409203000/https://sites.google.com/a/chromium.org/dev/chromium-os/chromiumos-design-docs/software-architecture |url-status=live }}</ref> {{As of|2019|2}}, systemd has been [[Systemd#Adoption|adopted]] by most major Linux distributions.<ref>See [[Systemd#Adoption]]</ref> == See also == * [[Operating system service management]] * [[Session Manager Subsystem]] β an equivalent in Windows NT == References == {{Reflist|30em}} == External links == * [https://www.freebsd.org/cgi/man.cgi?query=init&sektion=8&format=html FreeBSD init man page] * [https://arxiv.org/abs/0706.2748 A paper summarizing Unix init schemes] (2007) * {{webarchive |url=https://web.archive.org/web/20051231110711/http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html |date=December 31, 2005 |title=Solaris Service Management Facility - Quickstart Guide }} * [http://blog.darknedgy.net/technology/2015/09/05/0/ A history of modern init systems (1992–2015)] {{Webarchive|url=https://web.archive.org/web/20151011235646/http://blog.darknedgy.net/technology/2015/09/05/0/ |date=2015-10-11 }} {{Service management in Unix}} [[Category:Unix process- and task-management-related software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:About
(
edit
)
Template:Anchor
(
edit
)
Template:As of
(
edit
)
Template:Citation
(
edit
)
Template:Citation needed
(
edit
)
Template:Cite web
(
edit
)
Template:Details
(
edit
)
Template:Failed verification
(
edit
)
Template:Lowercase title
(
edit
)
Template:Man
(
edit
)
Template:Mono
(
edit
)
Template:Ordered list
(
edit
)
Template:Primary sources
(
edit
)
Template:Reflist
(
edit
)
Template:Service management in Unix
(
edit
)
Template:Short description
(
edit
)
Template:Webarchive
(
edit
)