Runit

Last updated
runit
Original author(s) Gerrit Pape
Initial releaseFebruary 10, 2004;20 years ago (2004-02-10) [1]
Stable release
2.2.0 / September 29, 2024;4 days ago (2024-09-29) [2]
Written in C, Shell
Operating system Linux, FreeBSD, OpenBSD, NetBSD, macOS, Solaris
Type Init daemon
License New BSD License
Website smarden.org/runit/   OOjs UI icon edit-ltr-progressive.svg

runit is an init and service management scheme for Unix-like operating systems that initializes, supervises, and ends processes throughout the operating system. Runit is a reimplementation of the daemontools [3] process supervision toolkit that runs on many Linux-based operating systems, as well as BSD, and Solaris operating systems. Runit features parallelization of the start up of system services, which can speed up the boot time of the operating system. [4]

Contents

When running as an init daemon, Runit is the direct or indirect ancestor of all other processes. It is the first process started during booting, and continues running until the system is shut down. It is often used with other init systems as a separate service manager. In the service manager role, it can be used by unprivileged users to orchestrate personal services, as well as by root to manage services not otherwise managed by the init system currently in use.

Runit booting Void Linux Runit-void.png
Runit booting Void Linux

Design

Runit focuses on being a small, modular, and portable codebase. In the init role, Runit is split into three stages: one time initialization, process supervision, and halting or rebooting. While the first and third stages must be adapted to the specific operating system they are running on, the second stage is portable across all POSIX compliant operating systems. [4] The 3 stages can be configured through 3 executable files (they are usually shell scripts) named, respectively, 1, 2, and 3.

Stage 2 usually invokes a binary named runsvdir, which is the process responsible for global daemon management: for every daemon it finds in a folder passed to it by argument, it then spawns an individual watchdog, each of those starts a daemon (and a logger service eventually associated to it) and restarts it if it dies. In case a daemon is added or removed, it kills the watchdog or starts a new one. Executable files with specific names are used to describe the various phases of the daemon's life (run, check, finish, ...), it can intercept signals sent and run by specific scripts if they exist, and named pipes are created to expose interfaces to control the daemon.

Usage

Runit can be used either as a drop-in replacement [5] for sysvinit, or as a service supervisor (with sysvinit as the parent PID 1 process which runs processes specified by the inittab file, or some other init system). [6] The RubyWorks stack of software able to run Ruby on Rails incorporated Runit into its suite. [7]

Adoption

Runit is the default init system of:

Runit is an "officially" available init system for:

Related Research Articles

<span class="mw-page-title-main">GNU Hurd</span> Operating system kernel designed as a replacement for Unix

GNU Hurd is a collection of microkernel servers written as part of GNU, for the GNU Mach microkernel. It has been under development since 1990 by the GNU Project of the Free Software Foundation, designed as a replacement for the Unix kernel, and released as free software under the GNU General Public License. When the Linux kernel proved to be a viable solution, development of GNU Hurd slowed, at times alternating between stasis and renewed activity and interest.

<span class="mw-page-title-main">Linux distribution</span> Operating system based on the Linux kernel

A Linux distribution is an operating system made from a software collection that includes the Linux kernel and often a package management system. They are often obtained from the website of each distribution, which are available for a wide variety of systems ranging from embedded devices and personal computers to servers and powerful supercomputers.

<span class="mw-page-title-main">FOSDEM</span> Annual event in Brussels centered on free and open source software development

Free and Open source Software Developers' European Meeting (FOSDEM) is a non-commercial, volunteer-organized European event centered on free and open-source software development. It is aimed at developers and anyone interested in the free and open-source software movement. It aims to enable developers to meet and to promote the awareness and use of free and open-source software.

A runlevel is a mode of operation in the computer operating systems that implements Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six. S is sometimes used as a synonym for one of the levels. Only one runlevel is executed on startup; run levels are not executed one after another.

Technical variations of Linux distributions include support for different hardware devices and systems or software package configurations. Organizational differences may be motivated by historical reasons. Other criteria include security, including how quickly security upgrades are available; ease of package management; and number of packages available.

init UNIX system component

In Unix-based computer operating systems, init 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.

Upstart is a discontinued 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. In 2014, Upstart was placed in maintenance mode, and other init daemons, such as systemd, were recommended in place of Upstart. Ubuntu moved away from Upstart with the release of version 15.04 in favor of migrating to systemd. As of June 2024, there have been no updates released for Upstart since September 2014.

The Linux booting process involves multiple stages and is in many ways similar to the BSD and other Unix-style boot processes, from which it derives. Although the Linux booting process depends very much on the computer architecture, those architectures share similar stages and software components, including system startup, bootloader execution, loading and startup of a Linux kernel image, and execution of various startup scripts and daemons. Those are grouped into 4 steps: system startup, bootloader stage, kernel stage, and init process. When a Linux system is powered up or reset, its processor will execute a specific firmware/program for system initialization, such as the power-on self-test, invoking the reset vector to start a program at a known address in flash/ROM, then load the bootloader into RAM for later execution. In IBM PC–compatible personal computers (PCs), this firmware/program is either a BIOS or a UEFI monitor, and is stored in the mainboard. In embedded Linux systems, this firmware/program is called boot ROM. After being loaded into RAM, the bootloader will execute to load the second-stage bootloader. The second-stage bootloader will load the kernel image into memory, decompress and initialize it, and then pass control to this kernel image. The second-stage bootloader also performs several operation on the system such as system hardware check, mounting the root device, loading the necessary kernel modules, etc. Finally, the first user-space process starts, and other high-level system initializations are performed.

<span class="mw-page-title-main">WeeChat</span> IRC client

WeeChat is a free and open-source Internet Relay Chat client that is designed to be light and fast. It is released under the terms of the GNU GPL-3.0-or-later and has been developed since 2003.

<span class="mw-page-title-main">Linux-libre</span> Version of the Linux kernel without proprietary code

According to the Free Software Foundation Latin America, Linux-libre is a modified version of the Linux kernel that contains no binary blobs, obfuscated code, or code released under proprietary licenses. In the Linux kernel, those types of code are mostly used for proprietary firmware images. While generally redistributable, they do not give the user the freedom to audit, modify, or, consequently, redistribute their modified versions. The GNU Project keeps Linux-libre in synchronization with the mainline Linux kernel.

Process supervision is a form of operating system service management in which some master process remains the parent of the service processes.

<span class="mw-page-title-main">Dragora GNU/Linux-Libre</span> Linux distribution

Dragora GNU/Linux-Libre is an Argentine Linux distribution written from scratch sharing some similarities with Slackware. It has a simple packaging system that allows installing, removing, upgrading and creating packages, although the system may be challenging to new users. As it only packages free software and uses the Linux-libre kernel, the Free Software Foundation endorses Dragora. Dragora is considered to be based on the "Keep it simple, stupid" (KISS) principle, believed by the authors to be a strength. Dragora can be downloaded from the web site or bought on CD.

systemd Suite of system components for Linux

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 manager" — an init system used to bootstrap user space and manage user processes. It also provides replacements for various daemons and utilities, including device management, login management, network connection management, and event logging. The name systemd adheres to the Unix convention of naming daemons by appending the letter d. It also plays on the term "System D", which refers to a person's ability to adapt quickly and improvise to solve problems.

lzip Data compression utility

lzip is a free, command-line tool for the compression of data; it employs the Lempel–Ziv–Markov chain algorithm (LZMA) with a user interface that is familiar to users of usual Unix compression tools, such as gzip and bzip2.

<span class="mw-page-title-main">OpenRC</span> Init system for Unix-like computer operating systems

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. It became more broadly adopted as an init system outside of Gentoo following the decision by some Linux distributions not to adopt systemd.

musl Implementation of C standard library for Linux operating system

musl is a C standard library intended for operating systems based on the Linux kernel, released under the MIT License. It was developed by Rich Felker to write a clean, efficient, and standards-conformant libc implementation.

<span class="mw-page-title-main">GNU Guix</span> Purely functional package manager for the GNU system

GNU Guix is a functional cross-platform package manager and a tool to instantiate and manage Unix-like operating systems, based on the Nix package manager. Configuration and package recipes are written in Guile Scheme. GNU Guix is the default package manager of the GNU Guix System distribution.

<span class="mw-page-title-main">Devuan</span> Linux distribution based on Debian

Devuan is a fork of the Debian Linux distribution that uses sysvinit, runit or OpenRC instead of systemd. Devuan aims to avoid "lock-in" by projects like systemd and aims to maintain compatibility with other init systems to avoid detaching Linux from other Unix systems.

References

  1. Pape, Gerrit (2004-02-10). "runit-1.0.0 release". gmane.comp.sysutils.supervision.general (Mailing list). Archived from the original on 2013-12-13. Retrieved 2013-12-10.
  2. Pape, Gerrit (2024-09-29). "runit-2.2.0 available". www.mail-archive.com. Retrieved 2024-10-03.
  3. Purcell, Steve (2007-11-11). "Init Scripts Considered Harmful". sanityinc.com. Retrieved 12 December 2013.
  4. 1 2 Pape, Gerrit. "runit - benefits" . Retrieved 23 April 2013.
  5. Pape, Gerrit. "replacing init" . Retrieved 11 August 2014.
  6. Pape, Gerrit. "use with traditional init" . Retrieved 11 August 2014.
  7. "Process management with runit". rubyworks.rubyforge.org. Retrieved 14 April 2014.
  8. "VoidLinux" . Retrieved 28 June 2020.
  9. "Gentoo" . Retrieved 28 April 2024.