OpenRC: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Fix broken reference URL
Adoption: Remove OpenBSD as it has never used OpenRC, but uses its own fork of NetBSD's rc.d
 
(47 intermediate revisions by 32 users not shown)
Line 1: Line 1:
{{Short description|Init system for Unix-like computer operating systems}}
{{refimprove|date=July 2019}}
{{more citations needed|date=July 2019}}
{{Infobox software
{{Infobox software
| name = OpenRC
| name = OpenRC
Line 5: Line 6:
| developer = OpenRC Developers
| developer = OpenRC Developers
| released = {{Start date and age|2007|04|05|df=yes}}
| released = {{Start date and age|2007|04|05|df=yes}}
| latest_release_version = 0.42.1
| latest_release_version = {{wikidata|property|reference|P348}}
| latest_release_date = {{Start date and age|2019|08|20|df=yes}}<ref>{{cite web | url=https://github.com/OpenRC/openrc/releases | title=openrc-0.42.1 | accessdate=September 19, 2019}}</ref>
| latest_release_date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| programming_language = [[C (programming language)|C]],<ref name="ohloh">{{citation |url=http://www.ohloh.net/p/openrc |publisher=[[Ohloh]] |work=Analysis Summary |title=openrc |accessdate=2012-03-10}}</ref> Shell
| programming_language = [[C (programming language)|C]],<ref name="ohloh">{{citation |url=http://www.ohloh.net/p/openrc |publisher=[[Ohloh]] |work=Analysis Summary |title=openrc |access-date=2012-03-10}}</ref> Shell
| operating_system = [[Linux]], [[FreeBSD]], [[NetBSD]], [[TrueOS]]
| operating_system = [[Linux]], [[FreeBSD]], [[NetBSD]]
| platform =
| platform =
| size = ~900 [[Kilobyte|KB]]
| size = ~1550 [[Kilobyte|KB]]
| language =
| language =
| genre = [[Init]] daemon
| genre = [[Init]] daemon
| license = [[Simplified BSD license|2-clause BSD license]]
| license = [[Simplified BSD license|2-clause BSD license]]
| website = {{URL|http://www.gentoo.org/proj/en/base/openrc/}}
| website = {{URL|https://wiki.gentoo.org/wiki/Project:OpenRC}}
}}
}}


'''OpenRC''' is a dependency-based [[init]] system for [[Unix-like]] computer [[operating system]]s. It was created by Roy Marples, a [[NetBSD]] developer who was also active in the Gentoo project.<ref>{{cite web |title=History |url=https://github.com/OpenRC/openrc/blob/master/HISTORY.md |accessdate=6 April 2020}}</ref><ref>{{cite web |title=Developers |url=https://www.netbsd.org/people/developers.html |accessdate=6 April 2020}}</ref> It became more broadly adopted as an init system outside of Gentoo following the decision by some [[Linux distribution]]s not to adopt [[systemd]].<ref>{{Cite web|url=https://distrowatch.com/weekly.php?issue=20150601|title=Manjaro OpenRC 0.8.13 - reinventing init without systemd |work = DistroWatch Weekly, Issue 612 | date = 1 June 2015|access-date=2020-04-04}}</ref><ref>{{cite web |title=5 Differences Between TrueOS & Linux |url=https://www.kompulsa.com/2018/02/23/5-differences-trueos-linux/ |accessdate=6 April 2020}}</ref><ref>{{cite web |title=Improving TrueOS: OpenRC |url=https://www.trueos.org/blog/improving-trueos-openrc/ |accessdate=6 April 2020}}</ref>
'''OpenRC''' is a dependency-based [[init]] system for [[Unix-like]] computer [[operating system]]s. It was created by Roy Marples, a [[NetBSD]] developer who was also active in the [[Gentoo Linux|Gentoo]] project.<ref>{{cite web |title=History |website=[[GitHub]] |url=https://github.com/OpenRC/openrc/blob/master/HISTORY.md |access-date=6 April 2020}}</ref><ref>{{cite web |title=Developers |url=https://www.netbsd.org/people/developers.html |access-date=6 April 2020}}</ref> It became more broadly adopted as an init system outside of Gentoo following the decision by some [[Linux distribution]]s not to adopt [[systemd]].<ref>{{Cite web|url=https://distrowatch.com/weekly.php?issue=20150601|title=Manjaro OpenRC 0.8.13 - reinventing init without systemd |work = DistroWatch Weekly, Issue 612 | date = 1 June 2015|access-date=2020-04-04}}</ref><ref>{{cite web |title=5 Differences Between TrueOS & Linux |date=23 February 2018 |url=https://www.kompulsa.com/2018/02/23/5-differences-trueos-linux/ |access-date=6 April 2020}}</ref><ref>{{cite web |title=Improving TrueOS: OpenRC |url=https://www.trueos.org/blog/improving-trueos-openrc/ |access-date=6 April 2020}}</ref>


[[File:Openrc-artix.png|thumb|OpenRC booting [[Artix Linux]]|329x329px]]
OpenRC is the default init system of [[Gentoo Linux|Gentoo]], [[Alpine Linux]], [[Hyperbola GNU/Linux-libre]], [[Parabola GNU/Linux-libre]], [[Artix Linux]], [[Maemo#Maemo Leste|Maemo Leste]], [[TrueOS]],<ref>{{Cite web|title=4. Post Installation Configuration — TrueOS® User Guide|url=https://www.trueos.org/handbook/postinstall.html#managing-system-services-and-daemons|access-date=2017-03-12|website=www.trueos.org|language=en}}</ref> [[Funtoo]] and other unix-like systems, while some others such as [[Devuan]] offer it as an option.<ref>{{Cite web|url=https://www.devuan.org/os/announce/ascii-stable-announce-060818|title=Devuan ASCII 2.0.0 stable release|language=en|access-date=2021-01-18}}</ref> That means that the software packages and daemons of those systems/distributions support it, coming with or using the available scripts.
[[File:Gentoo-grub-openrc-booting--thinkpad-t430.webm|thumb|Booting process|315x315px]]

== Adoption ==
OpenRC is the default [[init]] system [[and/or]] [[Process supervision|process supervisor]] for:

* [[Alpine Linux]]
* [[Funtoo]]
* [[Gentoo Linux]]
* [[Hyperbola GNU/Linux-libre]]
* [[Maemo#Maemo Leste|Maemo Leste]]
* Nitrux

OpenRC is an available [[init]] system [[and/or]] [[Process supervision|process supervisor]] for:

* [[Artix Linux]] (some consider it the default<ref>{{Cite web |title=Distro's forum - Which init system is Artix's default? |url=https://forum.artixlinux.org/index.php/topic,1769.0.html |access-date=2023-10-30 |language=en}}</ref>)
* [[Devuan]]<ref>{{Cite web |title=Devuan ASCII 2.0.0 stable release |url=https://www.devuan.org/os/announce/ascii-stable-announce-060818 |access-date=2021-01-18 |language=en}}</ref>
* [[Parabola GNU/Linux-libre]]


== Design ==
== Design ==
OpenRC is made up of several modular components, the main ones being an init(optional), the core dependency management system and a daemon supervisor(optional). It is written in C and POSIX compliant shell making it usable on BSD and Linux systems.
OpenRC is made up of several modular components, the main ones being an init (optional), the core dependency management system and a daemon supervisor (optional). It is written in C and POSIX-compliant shell, making it usable on BSD and Linux systems.


The core part of OpenRC handles dependency management and init script parsing. OpenRC works by scanning the runlevels, building a dependency graph, then starting the needed service scripts. It exits once the scripts have been started. By default, OpenRC uses a modified version of start-stop-daemon for daemon management.<ref>{{cite web |title=user guide |url=https://github.com/OpenRC/openrc/blob/master/user-guide.md#start-stop-daemon |accessdate=6 April 2020}}</ref>
The core part of OpenRC handles dependency management and init script parsing. OpenRC works by scanning the runlevels, building a dependency graph, then starting the needed service scripts. It exits once the scripts have been started. By default, OpenRC uses a modified version of start-stop-daemon for daemon management.<ref>{{cite web |title=user guide |website=[[GitHub]] |url=https://github.com/OpenRC/openrc/blob/master/user-guide.md#start-stop-daemon |access-date=6 April 2020}}</ref>


Init scripts share similarities with scripts used in [[sysvinit]], but offer several features to simplify their creation. Scripts are assumed to have start(), stop() and status() and the system uses variables already declared to create the default functions.<ref>{{cite web |title=service script guide |url=https://github.com/OpenRC/openrc/blob/master/service-script-guide.md#the-default-functions |accessdate=6 April 2020}}</ref> The depend function is used to declare dependencies to other services that would be done with LSB headers in sysvinit. Configuration and mechanism are separated with configuration files in the conf.d directory and init files in the init.d directory.
Init scripts share similarities with scripts used in [[sysvinit]], but offer several features to simplify their creation. Scripts are assumed to have {{code|start()}}, {{code|stop()}} and {{code|status()}}; and the system uses variables already declared to create the default functions.<ref>{{cite web |title=service script guide |website=[[GitHub]] |url=https://github.com/OpenRC/openrc/blob/master/service-script-guide.md#the-default-functions |access-date=6 April 2020}}</ref> The depend function is used to declare dependencies to other services that would be done with [[Linux Standard Base|LSB]] headers in sysvinit. Configuration and mechanism are separated with configuration files in the conf.d directory and init files in the init.d directory.


Openrc-init first appeared in version 0.25 as an optional replacement for [[Unix filesystem#Conventional directory layout|/sbin/init]]. Several other inits are supported including sysvinit and [[Busybox]].<ref>[http://wiki.gentoo.org/wiki/OpenRC OpenRC]</ref>
Openrc-init first appeared in version 0.25 as an optional replacement for [[Unix filesystem#Conventional directory layout|{{code|/sbin/init}}]]. This can replace Gentoo Linux's default init system, sysvinit.<ref>{{cite web|url=https://wiki.gentoo.org/wiki/OpenRC/openrc-init|accessdate=October 7, 2023|date=February 6, 2023|title=OpenRC/openrc-init}}</ref>


Supervise-daemon first appeared in version 0.21 giving openrc supervision capabilities. It can be enabled in the init script for supervise-daemon to start and monitor a daemon. Several other daemon supervisors are supported including [[runit]]<ref>{{cite web |title=runit guide |url=https://github.com/OpenRC/openrc/blob/master/runit-guide.md |accessdate=6 April 2020}}</ref> and s6.<ref>{{cite web |title=s6 Guide |url=https://github.com/OpenRC/openrc/blob/master/s6-guide.md |accessdate=6 April 2020}}</ref>
Supervise-daemon first appeared in version 0.21 giving OpenRC supervision capabilities. It can be enabled in the init script for supervise-daemon to start and monitor a daemon. Several other daemon supervisors are supported, including [[runit]]<ref>{{cite web |title=runit guide |website=[[GitHub]] |url=https://github.com/OpenRC/openrc/blob/master/runit-guide.md |access-date=6 April 2020}}</ref> and [[S6 (software)|s6]].<ref>{{cite web |title=s6 Guide |website=[[GitHub]] |url=https://github.com/OpenRC/openrc/blob/master/s6-guide.md |access-date=6 April 2020}}</ref>


== Features ==
== Features ==
{{prose|section|date=December 2020}}


* Portable between Linux, FreeBSD, and NetBSD<!-- OpenRC has been designed to be portable from the beginning. cgroups and other functionality which cannot be fully ported to FreeBSD or NetBSD is OPTIONAL -->
* Portable between [[Linux]], [[FreeBSD]], and [[NetBSD]]<!-- OpenRC has been designed to be portable from the beginning. cgroups and other functionality which cannot be fully ported to FreeBSD or NetBSD is OPTIONAL -->
* Parallel service startup (Off by default)
* Parallel service startup (off by default)
* Dependency based boot-up
* Dependency-based boot-up
* Process segregation through [[cgroups]]<ref>{{cite web |title=CGroups Support |url=https://wiki.gentoo.org/wiki/OpenRC#CGroups_support |accessdate=5 April 2020}}</ref>
* Process segregation through [[cgroups]]<ref>{{cite web |title=CGroups Support |url=https://wiki.gentoo.org/wiki/OpenRC#CGroups_support |access-date=5 April 2020}}</ref>
* Per-service resource limits (ulimit)
* Per-service resource limits (ulimit)
* Separation of code and configuration (init.d / conf.d)
* Separation of code and configuration (init.d / conf.d)
* Extensible startup scripts
* Extensible startup scripts
* Stateful init scripts (is it started already?)
* Stateful init scripts (''has it started already?'')
* Complex init scripts to start multiple components ([[Samba (software)|Samba]] (smbd and nmbd), [[Network File System|NFS]] (nfsd, portmap, etc.))
* Complex init scripts to start multiple components ([[Samba (software)|Samba]] [smbd and nmbd], [[Network File System|NFS]] [nfsd, portmap, etc.])
* Automatic dependency calculation and service ordering
* Automatic dependency calculation and service ordering
* Modular architecture and separation of optional components ([[Cron]], [[syslog]])
* Modular architecture and separation of optional components ([[cron]], [[syslog]])
* Expressive and flexible network handling (including [[Virtual private network|VPN]], bridges, etc.)
* Expressive and flexible network handling (including [[Virtual private network|VPN]], bridges, etc.)
* Verbose debug mode
* Verbose debug mode
Line 51: Line 68:
== References ==
== References ==
{{Reflist}}
{{Reflist}}

== External links ==

* {{Official website|http://www.gentoo.org/proj/en/base/openrc/}}
* {{github|OpenRC/openrc}}


{{Service management in Unix}}
{{Service management in Unix}}

Latest revision as of 16:52, 3 April 2024

OpenRC
Original author(s)Roy Marples
Developer(s)OpenRC Developers
Initial release5 April 2007; 17 years ago (2007-04-05)
Stable release
0.54[1] / 1 April 2024; 30 days ago (1 April 2024)
Repository
Written inC,[2] Shell
Operating systemLinux, FreeBSD, NetBSD
Size~1550 KB
TypeInit daemon
License2-clause BSD license
Websitewiki.gentoo.org/wiki/Project:OpenRC

OpenRC is a dependency-based init system for Unix-like computer operating systems. It was created by Roy Marples, a NetBSD developer who was also active in the Gentoo project.[3][4] It became more broadly adopted as an init system outside of Gentoo following the decision by some Linux distributions not to adopt systemd.[5][6][7]

OpenRC booting Artix Linux
Booting process

Adoption[edit]

OpenRC is the default init system and/or process supervisor for:

OpenRC is an available init system and/or process supervisor for:

Design[edit]

OpenRC is made up of several modular components, the main ones being an init (optional), the core dependency management system and a daemon supervisor (optional). It is written in C and POSIX-compliant shell, making it usable on BSD and Linux systems.

The core part of OpenRC handles dependency management and init script parsing. OpenRC works by scanning the runlevels, building a dependency graph, then starting the needed service scripts. It exits once the scripts have been started. By default, OpenRC uses a modified version of start-stop-daemon for daemon management.[10]

Init scripts share similarities with scripts used in sysvinit, but offer several features to simplify their creation. Scripts are assumed to have start(), stop() and status(); and the system uses variables already declared to create the default functions.[11] The depend function is used to declare dependencies to other services that would be done with LSB headers in sysvinit. Configuration and mechanism are separated with configuration files in the conf.d directory and init files in the init.d directory.

Openrc-init first appeared in version 0.25 as an optional replacement for /sbin/init. This can replace Gentoo Linux's default init system, sysvinit.[12]

Supervise-daemon first appeared in version 0.21 giving OpenRC supervision capabilities. It can be enabled in the init script for supervise-daemon to start and monitor a daemon. Several other daemon supervisors are supported, including runit[13] and s6.[14]

Features[edit]

  • Portable between Linux, FreeBSD, and NetBSD
  • Parallel service startup (off by default)
  • Dependency-based boot-up
  • Process segregation through cgroups[15]
  • Per-service resource limits (ulimit)
  • Separation of code and configuration (init.d / conf.d)
  • Extensible startup scripts
  • Stateful init scripts (has it started already?)
  • Complex init scripts to start multiple components (Samba [smbd and nmbd], NFS [nfsd, portmap, etc.])
  • Automatic dependency calculation and service ordering
  • Modular architecture and separation of optional components (cron, syslog)
  • Expressive and flexible network handling (including VPN, bridges, etc.)
  • Verbose debug mode

References[edit]

  1. ^ "Release 0.54". 1 April 2024. Retrieved 23 April 2024.
  2. ^ "openrc", Analysis Summary, Ohloh, retrieved 2012-03-10
  3. ^ "History". GitHub. Retrieved 6 April 2020.
  4. ^ "Developers". Retrieved 6 April 2020.
  5. ^ "Manjaro OpenRC 0.8.13 - reinventing init without systemd". DistroWatch Weekly, Issue 612. 1 June 2015. Retrieved 2020-04-04.
  6. ^ "5 Differences Between TrueOS & Linux". 23 February 2018. Retrieved 6 April 2020.
  7. ^ "Improving TrueOS: OpenRC". Retrieved 6 April 2020.
  8. ^ "Distro's forum - Which init system is Artix's default?". Retrieved 2023-10-30.
  9. ^ "Devuan ASCII 2.0.0 stable release". Retrieved 2021-01-18.
  10. ^ "user guide". GitHub. Retrieved 6 April 2020.
  11. ^ "service script guide". GitHub. Retrieved 6 April 2020.
  12. ^ "OpenRC/openrc-init". February 6, 2023. Retrieved October 7, 2023.
  13. ^ "runit guide". GitHub. Retrieved 6 April 2020.
  14. ^ "s6 Guide". GitHub. Retrieved 6 April 2020.
  15. ^ "CGroups Support". Retrieved 5 April 2020.