fbpx
Wikipedia

init

In Unix-based computer operating systems, init (short for initialization) is the first process started during booting of the operating system. Init is a daemon process that continues running until the system is shut down. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes. Init is started by the 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.

Version 7 Unix: /etc listing, showing init and rc
Version 7 Unix: contents of an /etc/rc Bourne shell script

In Unix systems such as System III and System V, the design of init has diverged from the functionality provided by the init in Research Unix and its BSD derivatives. Up until recently[when?], most Linux distributions employed a traditional init that was somewhat compatible with System V, while some distributions such as Slackware use BSD-style startup scripts, and others such as 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.

Research Unix-style/BSD-style edit

Research Unix init runs the initialization shell script located at /etc/rc,[1] then launches getty on terminals under the control of /etc/ttys.[2] 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.

BSD init was, prior to 4.3BSD, the same as Research UNIX's init;[3][4] in 4.3BSD, it added support for running a windowing system such as X on graphical terminals under the control of /etc/ttys.[5][6] To remove the requirement to edit /etc/rc, 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 1.5 and ported to FreeBSD 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.[7] The order in which scripts are executed is determined by the rcorder utility based on the requirements stated in these tags.

SysV-style edit

 
sysv-rc-conf, a 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,[8] 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 runlevels. 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 daemons, start or stop the X Window System, shutdown the machine, etc.

Runlevels edit

The runlevels 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:

  1. Turn off
  2. Single user mode (also known as S or s)
  3. Reboot

Aside from these standard ones, Unix and Unix-like systems treat runlevels somewhat differently. The common denominator, the /etc/inittab file, defines what each configured runlevel does in a given system.

Default runlevels edit

Operating system Default runlevel
AIX 2
antiX 5
Gentoo Linux 3[9]
HP-UX 3 (console/server/multiuser) or 4 (graphical)
Linux From Scratch 3
Slackware Linux 3
Solaris / illumos 3[10]
UNIX System V Releases 3.x, 4.x 2
UnixWare 7.x 3

On Linux distributions defaulting to runlevel 5 in the table on the right, runlevel 5 invokes a multiuser graphical environment running the X Window System, usually with a display manager like GDM or KDM. However, the Solaris and illumos operating systems typically reserve runlevel 5 to shut down and automatically power off the machine.

On most systems, all users can check the current runlevel with either the runlevel or who -r command.[11] The root user typically changes the current runlevel by running the telinit or init commands. The /etc/inittab file sets the default runlevel with the :initdefault: 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] 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.

Other implementations edit

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:

  • BootScripts in GoboLinux
  • busybox-init, suited to embedded operating systems, employed by OpenWrt before it was replaced with procd
  • Dinit, a service manager and init system.[12]
  • Epoch, a single-threaded Linux init system focused on simplicity and service management[13]
  • Initng, a full replacement of init designed to start processes asynchronously
  • launchd, a replacement for init in Darwin/macOS/iOS/tvOS starting with Mac OS X v10.4 (it launches SystemStarter to run old-style 'rc.local' 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 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[14]
  • Sun Service Management Facility (SMF), a complete replacement/redesign of init from the ground up in illumos/Solaris starting with Solaris 10, but launched as the only service by the original System V-style init
  • Shepherd, the GNU service and daemon manager which provides asynchronous, dependency-based initialisation; written in Guile Scheme and meant to be interactively hackable during normal system operation[15]
  • s6, a software suite that includes an init system. [16][17]
  • 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.
  • SystemStarter, a process spawner started by the BSD-style init in Mac OS X prior to Mac OS X v10.4
  • Upstart, a full replacement of init designed to start processes asynchronously. Initiated by Ubuntu and used by them until 2014. It was also used in Fedora 9,[18][19] Red Hat Enterprise Linux 6[20] and Google's ChromeOS.[21]

As of February 2019, systemd has been adopted by most major Linux distributions.[22]

See also edit

References edit

  1. ^ init(8) – Version 7 Unix Programmer's Manual
  2. ^ ttys(5) – Version 7 Unix Programmer's Manual
  3. ^ init(8) – 4.2BSD System Manager's Manual
  4. ^ ttys(5) – 4.2BSD File Formats Manual
  5. ^ init(8) – 4.3BSD System Manager's Manual
  6. ^ ttys(5) – 4.3BSD File Formats Manual
  7. ^ Andrew Smallshaw (7 December 2009). "Unix and Linux startup scripts, Part 2". from the original on 18 December 2009. Retrieved 6 June 2011.
  8. ^ "init(8)". minnie.tuhs.org. from the original on 2021-07-27. Retrieved 2015-09-12.
  9. ^ "Initscripts". Gentoo Linux Documentation. Gentoo.org. 2014-12-13. from the original on 2020-12-03. Retrieved 2020-12-08.
  10. ^ "Run Levels". Oracle Solaris Administration: Common Tasks. Oracle. from the original on 2016-04-10. Retrieved 2017-11-14.
  11. ^ . Unixhelp.ed.ac.uk. 1997-05-27. Archived from the original on 2014-07-14. Retrieved 2014-07-12.
  12. ^ "GitHub - davmac314/dinit: Service monitoring / "init" system". GitHub. from the original on 2021-12-12. Retrieved 2021-12-12.
  13. ^ "Epoch Init System Homepage". from the original on 2014-08-02. Retrieved 2014-07-31.
  14. ^ "Void Linux main page". from the original on 2020-08-29. Retrieved 2020-08-31.
  15. ^ "The Shepherd - GNU Project". Free Software Foundation, Inc. from the original on 2016-02-12. Retrieved 2016-01-16.
  16. ^ "s6: why another supervision suite". from the original on 2021-09-13. Retrieved 2021-09-13.
  17. ^ . Archived from the original on 2021-09-13.
  18. ^ Fedora 14 Accepted Features, 2010-07-13, from the original on 2022-03-27, retrieved 2010-07-13
  19. ^ "Fedora defers systemd to F15". Linux Weekly News. 2010-09-14. from the original on 2010-09-19. Retrieved 2010-09-17.
  20. ^ "Deployment". Red Hat Enterprise Linux 6: Technical Notes. Red Hat. from the original on 2018-08-29. Retrieved 2013-12-31.
  21. ^ Software Architecture: Chromium OS design documents, from the original on 9 April 2022, retrieved 25 January 2014
  22. ^ See Systemd#Adoption

External links edit

  • FreeBSD init man page
  • A paper summarizing Unix init schemes (2007)
  • at the Wayback Machine (archived December 31, 2005)
  • A history of modern init systems (1992–2015) 2015-10-11 at the Wayback Machine

init, this, article, about, unix, process, other, uses, init, disambiguation, this, article, relies, excessively, references, primary, sources, please, improve, this, article, adding, secondary, tertiary, sources, find, sources, init, news, newspapers, books, . This article is about the Unix process For other uses see INIT disambiguation This article relies excessively on references to primary sources Please improve this article by adding secondary or tertiary sources Find sources Init news newspapers books scholar JSTOR December 2020 Learn how and when to remove this template message In Unix based computer operating systems init short for initialization is the first process started during booting of the operating system Init is a daemon process that continues running until the system is shut down It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes Init is started by the 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 Version 7 Unix etc listing showing init and rcVersion 7 Unix contents of an etc rc Bourne shell scriptIn Unix systems such as System III and System V the design of init has diverged from the functionality provided by the init in Research Unix and its BSD derivatives Up until recently when most Linux distributions employed a traditional init that was somewhat compatible with System V while some distributions such as Slackware use BSD style startup scripts and others such as 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 Contents 1 Research Unix style BSD style 2 SysV style 2 1 Runlevels 2 2 Default runlevels 3 Other implementations 4 See also 5 References 6 External linksResearch Unix style BSD style editResearch Unix init runs the initialization shell script located at etc rc 1 then launches getty on terminals under the control of etc ttys 2 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 BSD init was prior to 4 3BSD the same as Research UNIX s init 3 4 in 4 3BSD it added support for running a windowing system such as X on graphical terminals under the control of etc ttys 5 6 To remove the requirement to edit etc rc 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 1 5 and ported to FreeBSD 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 7 The order in which scripts are executed is determined by the rcorder utility based on the requirements stated in these tags SysV style edit nbsp sysv rc conf a TUI utility that selects which SysV style init scripts will be run in each runlevelWhen compared to its predecessors AT amp T s UNIX System III introduced a new style of system startup configuration 8 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 runlevels 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 daemons start or stop the X Window System shutdown the machine etc Runlevels edit Further information Runlevel The runlevels 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 Turn offSingle user mode also known as S or s Reboot Aside from these standard ones Unix and Unix like systems treat runlevels somewhat differently The common denominator the etc inittab file defines what each configured runlevel does in a given system Default runlevels edit Operating system Default runlevelAIX 2antiX 5Gentoo Linux 3 9 HP UX 3 console server multiuser or 4 graphical Linux From Scratch 3Slackware Linux 3Solaris illumos 3 10 UNIX System V Releases 3 x 4 x 2UnixWare 7 x 3On Linux distributions defaulting to runlevel 5 in the table on the right runlevel 5 invokes a multiuser graphical environment running the X Window System usually with a display manager like GDM or KDM However the Solaris and illumos operating systems typically reserve runlevel 5 to shut down and automatically power off the machine On most systems all users can check the current runlevel with either the runlevel or a href Who Unix html title Who Unix who a r command 11 The root user typically changes the current runlevel by running the telinit or init commands The etc inittab file sets the default runlevel with the initdefault 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 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 Other implementations editTraditionally 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 BootScripts in GoboLinux busybox init suited to embedded operating systems employed by OpenWrt before it was replaced with procd Dinit a service manager and init system 12 Epoch a single threaded Linux init system focused on simplicity and service management 13 Initng a full replacement of init designed to start processes asynchronously launchd a replacement for init in Darwin macOS iOS tvOS starting with Mac OS X v10 4 it launches SystemStarter to run old style rc local 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 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 14 Sun Service Management Facility SMF a complete replacement redesign of init from the ground up in illumos Solaris starting with Solaris 10 but launched as the only service by the original System V style init Shepherd the GNU service and daemon manager which provides asynchronous dependency based initialisation written in Guile Scheme and meant to be interactively hackable during normal system operation 15 s6 a software suite that includes an init system 16 17 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 SystemStarter a process spawner started by the BSD style init in Mac OS X prior to Mac OS X v10 4 Upstart a full replacement of init designed to start processes asynchronously Initiated by Ubuntu and used by them until 2014 It was also used in Fedora 9 18 19 Red Hat Enterprise Linux 6 20 and Google s ChromeOS 21 As of February 2019 update systemd has been adopted by most major Linux distributions 22 See also editOperating system service management Session Manager Subsystem an equivalent in Windows NTReferences edit init 8 Version 7 Unix Programmer s Manual ttys 5 Version 7 Unix Programmer s Manual init 8 4 2BSD System Manager s Manual ttys 5 4 2BSD File Formats Manual init 8 4 3BSD System Manager s Manual ttys 5 4 3BSD File Formats Manual Andrew Smallshaw 7 December 2009 Unix and Linux startup scripts Part 2 Archived from the original on 18 December 2009 Retrieved 6 June 2011 init 8 minnie tuhs org Archived from the original on 2021 07 27 Retrieved 2015 09 12 Initscripts Gentoo Linux Documentation Gentoo org 2014 12 13 Archived from the original on 2020 12 03 Retrieved 2020 12 08 Run Levels Oracle Solaris Administration Common Tasks Oracle Archived from the original on 2016 04 10 Retrieved 2017 11 14 UNIX man pages runlevel 8 Unixhelp ed ac uk 1997 05 27 Archived from the original on 2014 07 14 Retrieved 2014 07 12 GitHub davmac314 dinit Service monitoring init system GitHub Archived from the original on 2021 12 12 Retrieved 2021 12 12 Epoch Init System Homepage Archived from the original on 2014 08 02 Retrieved 2014 07 31 Void Linux main page Archived from the original on 2020 08 29 Retrieved 2020 08 31 The Shepherd GNU Project Free Software Foundation Inc Archived from the original on 2016 02 12 Retrieved 2016 01 16 s6 why another supervision suite Archived from the original on 2021 09 13 Retrieved 2021 09 13 s6 init system Archived from the original on 2021 09 13 Fedora 14 Accepted Features 2010 07 13 archived from the original on 2022 03 27 retrieved 2010 07 13 Fedora defers systemd to F15 Linux Weekly News 2010 09 14 Archived from the original on 2010 09 19 Retrieved 2010 09 17 Deployment Red Hat Enterprise Linux 6 Technical Notes Red Hat Archived from the original on 2018 08 29 Retrieved 2013 12 31 Software Architecture Chromium OS design documents archived from the original on 9 April 2022 retrieved 25 January 2014 See Systemd AdoptionExternal links editFreeBSD init man page A paper summarizing Unix init schemes 2007 Solaris Service Management Facility Quickstart Guide at the Wayback Machine archived December 31 2005 A history of modern init systems 1992 2015 Archived 2015 10 11 at the Wayback Machine Retrieved from https en wikipedia org w index php title Init amp oldid 1166410561, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.