OpenRC is a dependency-based
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 direc ...
system for
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
computer
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
s. It was created by Roy Marples, a
NetBSD
NetBSD is a free and open-source Unix-like operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was fork (software development), forked. It continues to ...
developer who was also active in the
Gentoo project. It became more broadly adopted as an init system outside of Gentoo following the decision by some
Linux distribution
A Linux distribution, often abbreviated as distro, is an operating system that includes the Linux kernel for its kernel functionality. Although the name does not imply product distribution per se, a distro—if distributed on its own—is oft ...
s not to adopt
systemd
systemd is a software suite that provides an array of system components for Linux operating systems. The main aim is to unify service configuration and behavior across Linux distributions. Its primary component is a "system and service manage ...
.
Adoption
OpenRC is the default
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 direc ...
system or
process supervisor for:
*
Alpine Linux
*
Funtoo
*
Gentoo Linux
Gentoo Linux (pronounced ) is a Linux distribution built using the Portage package management system. Unlike a binary software distribution, the source code is compiled locally according to the user's preferences and is often optimized for ...
*
Hyperbola GNU/Linux-libre
*
Maemo Leste
* Nitrux
OpenRC is an available
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 direc ...
system or
process supervisor for:
*
Artix Linux (some consider it the default)
*
Devuan
Devuan is an open source, Debian-based Linux distribution that aims to maintain compatibility with other init systems and avoid lock-in by systemd. Devuan offers sysvinit, runit or OpenRC as alternatives to systemd.
History
With the relea ...
*
Parabola GNU/Linux-libre
Parabola GNU/Linux-libre is a Free and open-source software, free and open-source Linux distribution based on Arch Linux and Arch Linux ARM for the x86-64, i686, and ARMv7 architectures. It is distinguished from other Arch-based distributions b ...
*
Arch Linux (Available through the Arch User Repository)
*
PostmarketOS
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.
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.
Init scripts share similarities with scripts used in
sysvinit, but offer several features to simplify their creation. Scripts are assumed to have , and ; and the system uses variables already declared to create the default functions. 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
. This can replace Gentoo Linux's default init system, sysvinit.
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 and
s6.
Features
* Portable between
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
FreeBSD
FreeBSD is a free-software Unix-like operating system descended from the Berkeley Software Distribution (BSD). The first version was released in 1993 developed from 386BSD, one of the first fully functional and free Unix clones on affordable ...
, and
NetBSD
NetBSD is a free and open-source Unix-like operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was fork (software development), forked. It continues to ...
* Parallel service startup (off by default)
* Dependency-based boot-up
* Process segregation through
cgroups
* 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
Samba () is a broad term for many of the rhythms that compose the better known Brazilian music genres that originated in the Afro-Brazilians, Afro Brazilian communities of Bahia in the late 19th century and early 20th century, It is a name or ...
mbd and nmbd NFS fsd, portmap, etc.
* Automatic dependency calculation and service ordering
* Modular architecture and separation of optional components (
cron
The cron command-line utility is a job scheduler on Unix-like operating systems. Users who set up and maintain software environments use cron to schedule jobs (commands or shell scripts), also known as cron jobs, to run periodically at fixed t ...
,
syslog
In computing, syslog () is a standard for message logging. It allows separation of the software that generates messages, the system that stores them, and the software that reports and analyzes them. Each message is labeled with a facility code, ...
)
* Expressive and flexible network handling (including
VPN, bridges, etc.)
* Verbose debug mode
* User services
References
{{Service management in Unix
Software using the BSD license
Unix process- and task-management-related software