Fact-checked by Grok 2 weeks ago

Runlevel

A runlevel is a software configuration operating mode in Unix-like operating systems, particularly those employing the traditional SysV init system, which specifies the state of the system by controlling which services and daemons are started or stopped to achieve a particular operational environment. In this context, runlevels enable administrators to transition the system between different states, such as single-user maintenance mode or full multi-user production mode, by executing predefined scripts that manage processes. The SysV init system, originating from UNIX System V Release 4, defines runlevels through the /etc/inittab configuration file, which specifies the default runlevel and links to initialization scripts in directories like /etc/rc.d/rc[0-6].d/. These scripts, prefixed with 'S' for starting services or 'K' for killing them, are executed in numerical order during transitions to ensure orderly service management. Standard runlevels conventionally range from 0 to 6, with additional single-user modes denoted as 'S', though exact behaviors vary by implementation. Runlevels can be queried using the runlevel command, which reports the previous and current states, and changed via init or telinit commands, though caution is advised to prevent system instability. In modern Linux distributions, the systemd init system has largely superseded SysV runlevels, replacing them with targets for parallelized service management while maintaining backward compatibility through symbolic links (e.g., multi-user.target for runlevel 3). This evolution allows for more efficient booting and service control, with commands like systemctl recommended over legacy runlevel tools.

Core Concepts

Definition

A runlevel is a predefined operating mode in one of several distinct states of a Unix-like operating system, particularly those using System V-style initialization, where it specifies the configuration of system services, processes, and resources active during boot or runtime changes. This mode determines the overall operational state of the system by selectively enabling or disabling components to achieve specific functionality levels. Key characteristics of runlevels include their control over essential system elements such as daemons for background tasks, mounted file systems for data access, and network services for connectivity, thereby defining states from basic maintenance to fully operational multi-user environments. In this framework, runlevels represent a structured progression of system readiness, ensuring predictable behavior without requiring manual intervention for common operational shifts. Within SysV-style init systems, runlevels are designated by numeric identifiers conventionally ranging from 0 to 6, each associated with directories of scripts that the init process executes to manage service states upon entering or exiting the mode.

Purpose

Runlevels serve as predefined operating modes in Unix-like systems, enabling the init process to transition the system into specific states by starting or stopping designated services. This mechanism supports controlled boot sequences, where services are activated in a structured order to ensure system stability, as well as maintenance modes for targeted repairs and graceful shutdowns that halt operations systematically to prevent data loss. By allowing administrators to activate or deactivate groups of services without requiring a full system reboot, runlevels facilitate efficient resource management during runtime adjustments. The primary advantages of runlevels lie in their ability to simplify system administration through the isolation of service dependencies into discrete operational levels, permitting quick switches between configurations without manual intervention for each service. This approach enhances fault isolation during troubleshooting, as lower operational modes can limit active components to pinpoint issues without interference from unnecessary processes. Additionally, runlevels promote security by restricting services in restricted modes, reducing potential vulnerabilities during sensitive tasks like file system repairs. For instance, entering a minimal mode allows exclusive root access for diagnostics or upgrades, while standard modes enable full multi-user access with necessary network capabilities. Common use cases include routine maintenance, such as switching to a single-user mode for system repairs or backups, and transitioning to multi-user modes for everyday operations like server hosting or desktop usage. These transitions ensure orderly service management, supporting tasks from emergency recovery to optimized performance in production environments. However, runlevels exhibit limitations in handling complex service dependencies, as they rely on static assignments to levels without fine-grained dynamic ordering, which can complicate management in intricate setups.

History and Development

Origins in Unix System V

The concept of runlevels originated within the development of Unix System V at AT&T Bell Laboratories, where structured system initialization emerged to address the increasing complexity of Unix environments during the early 1980s. In System V Release 1 (SVR1), released in 1983, the init process was introduced as a central dispatcher for managing system startup and process control, utilizing the /etc/inittab file to define states and process behaviors. Runlevels were formalized at this stage as a numeric system (0 through 6), with the rstate field in /etc/inittab tying processes to specific runlevels and the init command supporting transitions via arguments such as init 2 for multi-user mode. This approach marked a departure from prior Unix versions, providing a modular framework for handling system resources amid growing demands for reliability in commercial deployments. By System V Release 3 (SVR3) in 1987, runlevels were refined with improved integration for advanced features such as remote file sharing, where init 3 enabled multi-user mode with networking. AT&T Bell Labs engineers documented these runlevels in the SVR3 manuals, emphasizing their role in standardizing boot sequences and service management. The /etc/inittab file supported special actions for power failures and boot-time tasks, reflecting contributions from Bell Labs' systems programming team who integrated feedback from internal testing to enhance the init framework. The primary motivation for introducing runlevels stemmed from the need to impose order on increasingly intricate Unix boot processes, as systems expanded to support networked and multi-user commercial applications. Unlike BSD's simpler /etc/rc scripts, which relied on sequential execution without discrete levels, System V adopted numeric runlevels to enable granular control over service activation, facilitating easier maintenance, troubleshooting, and scalability in diverse hardware environments. This design choice allowed administrators to switch states predictably, reducing downtime and errors in production settings. Early adoption of runlevels gained traction in commercial Unix variants by the late 1980s, with implementations appearing in SVR4 (1988), where they became integral to the init system's operation across AT&T-licensed platforms. Vendors such as Sun Microsystems and Hewlett-Packard incorporated SysV init features into their offerings, promoting widespread use in enterprise systems for consistent state management. By this period, runlevels had established themselves as a cornerstone of System V-style initialization, influencing subsequent Unix derivatives and solidifying their role in operational standardization.

Standardization Efforts

Following the initial development of runlevels in Unix System V, standardization efforts sought to promote consistency across Unix-like systems by addressing init process behaviors, though runlevels themselves were not fully integrated into broader specifications. The POSIX.1 standard, published in 1988 by the IEEE, established foundational interfaces for process creation, management, and termination, designating the init process as process ID 1 and the ancestor of all other processes, but it did not define or require runlevel mechanisms, leaving them as a System V-specific feature. Similarly, the Single UNIX Specification (SUS), starting with Version 1 in 1990 and evolving through subsequent editions, extended POSIX with additional utilities and real-time extensions while specifying init-related behaviors such as signal handling and process groups, yet explicitly omitted runlevels to maintain focus on portable application interfaces rather than system initialization modes. A key milestone in runlevel standardization came with the Linux Standard Base (LSB), initiated in 2001 by the Free Standards Group (later acquired by the Linux Foundation) to enhance interoperability among Linux distributions. The LSB specified runlevel semantics in its core specifications, defining runlevels 0 through 6 for use in init scripts, including conventions for default start and stop actions to ensure consistent service management across conforming systems. This effort produced multiple versions, from LSB 1.0 in June 2001, which introduced binary compatibility guidelines including runlevel handling, to LSB 5.0 in 2015, which refined desktop and multimedia integrations while maintaining runlevel definitions for backward compatibility. Other standards, such as the Unix 98 brand (aligned with SUS Version 2 in 1997), indirectly supported runlevel concepts by certifying systems for POSIX compliance and adding utilities like those for process control, but they did not mandate runlevels, allowing vendor-specific implementations to persist. Challenges to cross-platform consistency arose from proprietary extensions in commercial Unix variants, such as those from Sun Microsystems or HP, which modified init behaviors without aligning on runlevel numbering or transitions. These efforts achieved partial success within the Linux ecosystem, where LSB compliance facilitated software portability and reduced fragmentation among distributions, but adoption remained limited in non-Linux Unix-like systems, where alternative initialization frameworks and proprietary modifications hindered uniform runlevel usage.

Standard Runlevels

Descriptions of Runlevels 0-6

Runlevels 0 through 6 represent standardized operating states in Linux systems using Unix System V-style initialization, each configuring a specific set of services and processes to manage system behavior from shutdown to full operation. These runlevels are defined in the Linux Standard Base (LSB) as a means to ensure compatibility across compliant Linux distributions, drawing from traditional SysV init practices, though non-Linux SysV derivatives may vary in implementation. The init process transitions between them by executing or terminating scripts in designated directories, such as /etc/rcX.d, where X is the runlevel number. Runlevel 0 initiates a system halt, terminating all processes and powering off the machine after completing shutdown procedures. This state ensures a safe stop without rebooting, often used for maintenance or power conservation. Runlevel 1, also denoted symbolically as 'S' or 's', enters single-user mode, providing root access with minimal services running, such as basic file system mounts but no networking or multi-user capabilities. This mode is ideal for administrative tasks like filesystem repairs, as it limits interference from other users or daemons. In /etc/inittab configurations, the 'S' symbol triggers initialization scripts like /sbin/rcS for essential boot steps before full single-user entry. Runlevel 2 supports multi-user mode without exporting network services, enabling local text-based logins and basic system operations but restricting remote access. This configuration runs multi-user terminal processes and daemons locally, suitable for environments where networking is unnecessary or disabled for security. Runlevel 3 provides full multi-user mode with networking enabled, starting console operations, server daemons, and network interfaces for standard system use. This is the typical default for server environments, allowing multiple users, remote logins, and full resource availability over the network. Runlevel 4 is user-definable and often left unused or configured for specialized setups, such as additional services beyond runlevel 3 without altering the standard multi-user state. By default, it mirrors runlevel 3 in many implementations, serving as a flexible extension for custom environments. Runlevel 5 extends multi-user mode to include a graphical interface, typically via the X Window System or equivalent display manager like xdm, common in desktop-oriented systems. This state activates graphical login screens and related services while maintaining full networking and multi-user support. Runlevel 6 triggers a system reboot, shutting down processes and restarting the operating system after performing necessary cleanup. This state returns the system to its initial boot sequence, defined by the initdefault in /etc/inittab. Additionally, symbolic notations like 'N' indicate no previous runlevel, often displayed at initial boot when querying the current state via tools like runlevel(8). This helps distinguish first-time initialization from transitions.

Special and Non-Standard Runlevels

In Unix-like systems, special runlevels extend beyond the standard numeric levels 0 through 6 to provide targeted environments for maintenance and recovery. One such runlevel is 'S' (or equivalently 's'), which represents single-user mode and is primarily used during the boot process or for transitioning to a minimal administrative state. This mode limits the system to essential services, mounting the root filesystem and providing a root shell without requiring a password in many cases, facilitating basic repairs or configuration changes. SysV init also supports additional special runlevels 'a', 'b', and 'c', which are used during the boot process to single-user mode. These runlevels process only specific entries in the /etc/inittab file: 'a' for entries before the single-user shell, 'b' for those between the shell and /etc/io.d initialization, and 'c' for entries after /etc/io.d. They allow fine-grained control over boot-time initialization without entering full single-user mode. Additionally, 'Q' or 'q' signals init to re-examine and reload the /etc/inittab file without changing the current runlevel, useful for applying configuration changes dynamically. Beyond these, non-standard runlevels such as 7, 8, and 9 are supported by the init process in SysV-style systems but lack formal documentation or universal definition, allowing vendors or administrators to define custom behaviors. For instance, these levels may be employed in specialized setups for high-availability clustering or additional graphical interfaces, where runlevel 7 could enable specific failover services. Vendor-specific deviations further adapt runlevel meanings; while many adhere to conventions like runlevel 3 for multi-user text mode and 5 for graphical, some systems repurpose level 4 for alternative console configurations or debugging. These special and non-standard runlevels are essential in disaster recovery scenarios, enabling administrators to intervene when conventional operating states fail, such as after hardware issues or misconfigurations that halt normal booting. By providing isolated, controlled access, they minimize risks while maximizing repair flexibility.

Operational Mechanisms

Init Process and Runlevel Management

The init daemon serves as the initial process (PID 1) on Unix-like systems implementing the System V (SysV) initialization scheme, acting as the parent of all other processes and responsible for bootstrapping the system by spawning and managing essential services based on the current runlevel. Upon system startup, init reads the configuration file /etc/inittab to determine the default runlevel and initiate the appropriate processes, ensuring controlled transitions between operational states. The /etc/inittab file defines the system's initialization behavior through entries in the syntax id:runlevels:action:process, where id is a unique two-character identifier, runlevels specifies the applicable runlevels (e.g., 123 for levels 1 through 3), action dictates the execution behavior (such as initdefault to set the default runlevel, sysinit for boot-time scripts, wait to run once and wait for completion, or respawn to automatically restart the process if it terminates), and process is the command or script to execute. For instance, an entry like si::sysinit:/sbin/autopush -f /etc/iu.ap runs STREAMS initialization during system startup in Solaris, while id:3:initdefault: establishes runlevel 3 as the default multi-user mode. This structure allows init to handle both one-time boot tasks and ongoing process supervision, re-examining the file as needed for dynamic changes. Runlevel management relies on a hierarchy of script directories: the actual service scripts reside in /etc/init.d/ (or equivalently /etc/rc.d/init.d/ in some implementations), containing executable shell scripts that define start, stop, and status actions for daemons and services. For each runlevel N (0 through 6), the directory /etc/rcN.d/ holds symbolic links to these scripts, prefixed with S for start (e.g., S10network) to invoke the start action or K for kill (e.g., K20network) to stop the service, with the two-digit suffix (xx) determining execution order to respect dependencies—lower numbers run first. When entering a new runlevel, init executes the relevant scripts in numerical sequence: first stopping services not needed in the target runlevel (via Kxx links from the previous level), then starting those required (via Sxx links in the new level). During the boot sequence, init first processes runlevel S (single-user mode) to perform essential tasks like mounting filesystems and running sysinit scripts, transitioning from this minimal state to the default runlevel—typically 3 for multi-user text mode or 5 for graphical mode—by sequentially executing the corresponding rcN.d scripts to activate networking, daemons, and other services in dependency order. This ordered progression ensures system stability, with init monitoring and respawning critical processes as defined in inittab throughout operation.

Changing Runlevels

Changing runlevels in System V Unix-like systems is typically accomplished using the init command, which signals the init process (PID 1) to transition the system to a specified runlevel by executing the appropriate rc scripts. The syntax is init N, where N is a digit from 0 to 6 representing the target runlevel; for example, init 3 switches to multi-user mode with networking enabled. This command requires root privileges, as only the superuser can alter the system's operational state. An alternative to init is the telinit command, which serves as a lightweight wrapper that sends signals directly to the running init process without forking a new one, making it more efficient for runtime changes. Like init, it uses the syntax telinit N for numeric runlevels, but it also supports symbolic arguments such as S or s for single-user mode, allowing skips in certain process termination steps if needed. In practice, telinit is often preferred over init for non-boot-time transitions due to its focused role in communicating runlevel requests. During a runlevel change, the init process rereads the /etc/inittab configuration file to identify differences between the current and target runlevels, terminating services associated only with the current level by sending SIGTERM (followed by SIGKILL after a configurable grace period, defaulting to 3 seconds as of sysvinit 2.92) while preserving those common to both. It then starts services specific to the new runlevel according to their defined actions (e.g., respawn for persistent daemons or once for one-time execution), potentially resulting in partial transitions for special cases like init 0 (halt), which focuses on shutdown without full multi-user startup. The process updates the system's utmp and wtmp logs to record the previous and new runlevels. Safety considerations are critical when changing runlevels, particularly for abrupt shifts like 0 (halt) or 6 (reboot), which can lead to data loss if unsaved work or disk syncs are incomplete; administrators are advised to use the sync command beforehand and notify users via broadcasts. For such changes, init automatically issues a warning message to all logged-in users using the wall mechanism, informing them of the impending shutdown or reboot to allow graceful logout. Partial or emergency transitions, such as to single-user mode, should be tested in non-production environments to avoid service disruptions. To monitor the current runlevel, the runlevel command can be used, which outputs the previous and current runlevels separated by a space (e.g., "N 3" if the previous is unknown), drawing from the utmp file. Alternatively, who -r displays the runlevel alongside system uptime and other status details, providing a quick query of the operational state without requiring additional tools.

Implementations in Linux

Linux Standard Base (LSB)

The Linux Standard Base (LSB) provides a set of specifications aimed at ensuring consistency in system initialization and runlevel management across Linux distributions, promoting portability of applications and scripts. The core specifications began with LSB 1.0 in June 2001, which introduced standards for runlevels and init scripts, and evolved through versions 1.1 to 1.3 (2002), 2.0 to 2.1 (2004–2005), 3.0 to 3.2 (2005–2008), 4.0 to 4.1 (2009–2011), culminating in LSB 5.0 released on June 3, 2015, as the final modular iteration. These versions define runlevel behaviors by standardizing the states of the system (runlevels 0 through 6) and the mechanisms for transitioning between them, allowing compiled applications and installation scripts to operate reliably without distribution-specific adaptations. LSB requirements for runlevels focus on defining expected system states and enforcing conventions for service management through init scripts. For instance, runlevel 2 supports multiuser mode without exported network services, while runlevel 3 enables full multiuser operation with networking, and runlevel 5 adds a display manager; services like cron are typically configured to start in runlevels 2–5, and networking facilities in 3–5, using standardized dependencies in script headers. Init scripts must adhere to comment conventions, including keywords such as Default-Start and Default-Stop to specify runlevels (e.g., Default-Start: 2 3 4 5 for a service active in multiuser modes), along with Required-Start for dependencies like $network or $local_fs, ensuring ordered execution during boot or shutdown. These standards apply to start/stop actions, with optional support for reload and status, promoting reliable service lifecycle management. Conformance to LSB runlevel specifications requires implementations to support the /sbin/init process, which reads /etc/inittab to control system states and runlevel changes, and to maintain directory structures for script execution. Init scripts are placed in /etc/init.d, with activation via tools like /usr/lib/lsb/install_initd that create symbolic links in /etc/rcN.d directories (where N denotes the runlevel, e.g., /etc/rc3.d for runlevel 3), using Snn (start) and Knn (kill) prefixes for ordering. Distributions historically achieved certification through the Linux Foundation's testing infrastructure, including the LSB-Core test suite, which validated init script handling, runlevel transitions, and facility dependencies to ensure interoperability. As of 2025, LSB and traditional runlevels are largely legacy, with most distributions using systemd for init management while providing backward compatibility for legacy purposes. The LSB's runlevel standards significantly enhanced binary compatibility and script portability across Linux distributions by providing a common framework for system initialization, reducing vendor-specific variations in service startup. However, by the 2020s, as modern init systems like systemd gained dominance, explicit runlevel support was deprecated in favor of target units, though compatibility layers maintain LSB init script execution for legacy purposes.

Variations Across Distributions

Slackware employs a straightforward configuration for runlevels through its /etc/inittab file, which defines the system's initial state and transitions. The default runlevel is 3, providing multi-user mode with a text-based console login and full network support, while runlevel 2 offers multi-user functionality with networking services, similar to runlevel 3. For graphical environments in runlevel 4, users must manually configure the X Window System, often by editing /etc/inittab to set id:4:initdefault: and ensuring a display manager is installed, as no automatic graphical boot is provided by default. Slackware does not achieve full compliance with the Linux Standard Base (LSB) for runlevel management, prioritizing simplicity over standardized scripting conventions. In Gentoo, runlevels are highly customizable through the /etc/runlevels/ directory structure, where subdirectories like default, boot, and sysinit hold symbolic links to init scripts for specific operational states. The OpenRC init system, Gentoo's default, enables profile-based definitions of runlevels, allowing users to tailor service dependencies and boot sequences during installation via profiles that influence which services link to runlevels. This approach supports hybrid setups combining traditional SysV-style runlevels with optional systemd integration, offering flexibility for embedded or specialized systems without strict adherence to numeric runlevel norms. Debian traditionally relies on sysvinit for runlevel handling in pre-systemd installations, with runlevel 2 serving as the default for multi-user mode, enabling console logins, networking, and most services but excluding graphical interfaces. Graphical desktops, if installed, start via services enabled in this runlevel rather than a dedicated one. The file-rc package provides an alternative to traditional rc scripts, managing runlevel transitions through a dependency-based /etc/runlevel.conf file that links services to runlevels without numeric script directories. Debian maintains partial LSB compliance for init scripts but deviates in default runlevel usage to consolidate multi-user operations under 2. Distributions like Red Hat Enterprise Linux (RHEL), prior to adopting systemd, designated runlevel 5 for graphical multi-user mode, automatically launching a display manager such as GDM for X sessions upon boot. Service management in these runlevels utilized the chkconfig tool to create symbolic links in /etc/rc.d/rc[runlevel].d/ directories, enabling or disabling scripts across levels like 3 (text multi-user) and 5. RHEL achieved LSB certification for core runlevel features in versions up to 7, though later releases phased out full compliance. Common patterns across distributions include tailoring defaults for server versus desktop use; for instance, Ubuntu, as a Debian derivative, defaulted to runlevel 2 pre-systemd for both server (text-only multi-user) and desktop variants, with graphical sessions initiated through services like the display manager rather than a separate runlevel. These variations, while diverging from LSB ideals of uniform runlevel 3 for text multi-user and 5 for graphical, reflect optimizations for specific use cases like resource efficiency in servers.

Implementations in Other Unix-like Systems

System V Derivatives

Runlevels were first introduced in Release 3 (SVR3), released in 1987, as a to define distinct operating states of the , managed through the /etc/inittab . This file specified the initial default runlevel and controlled spawning based on a colon-separated format of identifier, runlevel(s), action, and command, enabling the init (PID 1) to initialize the and transition between states. The basic runlevels 0 through 6 were defined with a focus on console operations: runlevel 0 for halting the , 1 (or s/S) for single-user mode suitable for administrative tasks with limited file systems mounted, 2 for multiuser mode without remote file sharing, 3 for multiuser mode with remote file sharing enabled, 4 as a user-definable state, 5 for shutdown or power-off, and 6 for rebooting. spawning relied on actions like respawn to automatically restart essential services such as getty for console logins, ensuring continuous availability on the console. In UNIX System V Release 4 (SVR4), released in 1988, runlevel management was enhanced with a more structured scripting approach using directories like /etc/rcN.d (where N denotes the runlevel), containing symbolic links to initialization scripts in /etc/init.d prefixed with S (start) or K (kill) for ordered execution during transitions. These scripts allowed for finer control over service startup and shutdown, improving upon SVR3's reliance on direct inittab entries by enabling lexicographical ordering of operations. SVR4 also introduced support for the X Window System as an optional component. Additionally, SVR4 standardized shutdown procedures through the shutdown command and associated K-prefixed scripts, ensuring orderly termination of services before halting or rebooting the system. General features of runlevels in System V derivatives centered on the init process's reliance on /etc/inittab for spawning and respawning processes tailored to the current runlevel, with transitions initiated via the init command (e.g., init 2 to enter multiuser mode). This allowed seamless state changes, such as mounting file systems or starting network services, while maintaining console-centric operations for essential tasks. By the 2010s, pure System V runlevel implementations had largely been phased out in favor of vendor-specific operating systems and modern init systems, though they remained the basis for compatibility modes in distributions supporting legacy SysVinit scripts.

Solaris and illumos

In earlier versions of Solaris, including up to Solaris 10 released in 2005, the operating system employed the traditional System V (SysV) init mechanism to manage runlevels 0 through 6. These runlevels were controlled via scripts located in directories such as /etc/rc0.d through /etc/rc6.d, where files prefixed with S initiated services and those prefixed with K terminated them during state transitions. Solaris 10 introduced the Service Management Facility (SMF), a dependency-based framework that largely supplanted traditional runlevels with milestones to provide more granular and reliable service management. Milestones represent system states analogous to runlevels, such as milestone/single-user (corresponding to runlevel S for single-user mode), milestone/multi-user (runlevel 2 for multiuser without networking resources), and milestone/multi-user-server (runlevel 3 for full multiuser with shared networking resources). Transitions between these states are handled by the svcadm command, though the init command remains available for compatibility, indirectly affecting milestones. Illumos, an open-source fork of OpenSolaris initiated after Oracle's acquisition in 2010, inherits and preserves the SMF architecture from Solaris 10 and later. It emulates traditional runlevels as SMF states while providing a compatibility layer for legacy SysV scripts, allowing them to operate as non-SMF-managed "legacy-run" instances without full dependency resolution. This setup ensures backward compatibility for older applications while encouraging migration to native SMF services. A distinctive feature in Solaris and illumos SPARC systems is the handling of runlevel 0, which halts the operating system and transfers control to the OpenBoot PROM (OBP) firmware, displaying the ok prompt for low-level diagnostics and boot configuration. Additionally, runlevel 3 supports graphical desktop environments, such as the Common Desktop Environment (CDE) or GNOME, when relevant services are enabled, differing from conventions in other Unix-like systems where a separate runlevel is typically designated for graphical modes.

HP-UX and AIX

HP-UX implements runlevels based on the System V (SysV) initialization model, where the /sbin/init process reads the /etc/inittab file to determine the default runlevel and manage transitions between system states. The standard runlevels include 0 for system halt, s or S for single-user mode with root filesystem mounted, 1 for single-user mode with all filesystems mounted and syncer running, 2 for basic multiuser mode allowing multiple logins, and 3 for multiuser mode with NFS exports and web-based administration tools like the HP System Management Homepage (HP SMH). Runlevel changes invoke /sbin/rc, which executes start (S-prefixed) or kill (K-prefixed) scripts in directories like /sbin/rc2.d or /sbin/rc3.d, enabling controlled activation or deactivation of services. The System Administration Manager (SAM), a graphical interface for system configuration, supports tasks such as kernel tuning and peripheral management but does not directly alter runlevel definitions; in HP-UX 11i v3 and later, SAM has been largely supplanted by the web-based HP SMH for routine administration. HP-UX supports trusted mode as a C2-level security configuration, which enforces stricter access controls, stores authentication data in /tcb/files/auth instead of /etc/passwd, and includes features like compartments, role-based access control (RBAC), and auditing; this mode is enabled system-wide via tools like SAM or command-line utilities and operates across runlevels without tying to a specific one like 4, though runlevel 4 remains available for user-defined multiuser extensions with features such as pseudo-TTYs and volume management. In HP-UX 11i releases from the 2000s, enhancements to scripting in /etc/inittab and rc directories improved flexibility for enterprise environments, allowing better integration with virtual partitions (vPars) for dynamic resource allocation without full runlevel shifts. AIX employs a SysV-compatible runlevel system defined in /etc/inittab, where the init process spawns subsystems and executes rc scripts in /etc/rc.d/rcX.d directories (X being the runlevel) to transition states, with the default often set to 2 via the initdefault entry. Runlevel 2 provides base multiuser mode with networking enabled but without advanced services like NFS, while runlevel 3 extends this to include networking plus additional daemons for file sharing and administrative tasks; higher levels (4-9) are user-definable, and special modes like a, b, or c start processes without terminating existing ones. The System Resource Controller (SRC), integrated alongside init, manages subsystem lifecycle through commands like startsrc, stopsrc, and lssrc, enabling granular control over daemons without requiring full runlevel changes. Both HP-UX and AIX prioritize enterprise reliability through SysV foundations, supporting dynamic reconfiguration—such as AIX's concurrent kernel updates via Dynamic Logical Partitioning (DLPAR) or HP-UX's vPars for resource shifts—while minimizing downtime compared to rigid runlevel reboots. In AIX 7 (released 2010), legacy runlevel support persists via /etc/inittab and SRC, with integrations like PowerSC for security compliance ensuring hardened configurations across states without altering core mechanisms.

BSD Systems

In BSD variants such as FreeBSD, NetBSD, OpenBSD, and DragonFly BSD, there are no native numeric runlevels analogous to those in System V Unix systems; instead, system initialization and service management rely on a hierarchical set of shell scripts executed by the rc(8) utility. The primary configuration file, /etc/rc.conf, along with defaults in /etc/defaults/rc.conf, determines which services start during boot, with overrides for local customization. This approach emphasizes simplicity, using dependency declarations within scripts to order execution via tools like rcorder(8) in NetBSD. Boot modes in BSD are controlled through kernel flags or commands rather than persistent runlevel states. For instance, single-user mode—providing a root shell for maintenance tasks without full service startup—is entered by appending the -s flag to the boot loader or issuing shutdown now 0 from multi-user mode. Multi-user mode, the default operational state, mounts filesystems, configures networking, and launches daemons via scripts in the /etc/rc.d directory, which support standard actions like start, stop, and restart. These scripts are invoked sequentially during startup, with no concept of discrete levels like SysV's 3 (multi-user text) or 5 (multi-user graphical). To accommodate System V compatibility, FreeBSD and NetBSD include emulation for tools like the runlevel command, which simulates output by mapping multi-user mode to a conventional value such as 3, though this does not alter the underlying BSD init behavior. Runlevel-like functionality can be approximated through rc.conf variables that conditionally enable services, such as setting graphical boot options or limiting to console mode, but these are one-time flags rather than switchable states. Modern BSD implementations preserve this script-driven model without adopting formal standards like the Linux Standard Base. OpenBSD uses rcctl(8) for service control alongside /etc/rc.d scripts, maintaining a minimalistic structure focused on security and reliability. Similarly, DragonFly BSD employs /etc/rc scripts for filesystem mounting and daemon startup, emphasizing efficiency in its rc.conf-based configuration without runlevel abstractions. This contrasts with SysV's structured levels by prioritizing flexible, dependency-resolved scripting over predefined modes.

Transition to Modern Init Systems

Deprecation of Runlevels

Traditional runlevels reached their peak usage in the 1990s and 2000s, forming the cornerstone of system initialization in most Unix-like operating systems, including Linux distributions and System V derivatives. Their decline accelerated after 2010 with the emergence of modern init systems that offered more flexible service management, culminating in explicit declarations of obsolescence by 2014 and complete removal of support in systemd version 258 by 2025. By 2025, only a small number of Linux servers rely on pure SysV init with traditional runlevels, reflecting the widespread shift to alternatives amid the dominance of cloud-native architectures. The primary reasons for this deprecation include the inherent rigidity of runlevels, which enforce coarse-grained, sequential service activation without robust dependency resolution, leading to brittle configurations in complex environments. This limitation hampers scalability in cloud and containerized setups, where parallel bootstrapping and on-demand service orchestration are essential for efficient resource utilization and rapid deployment. Furthermore, legacy SysV init scripts introduce security vulnerabilities through outdated scripting practices prone to injection flaws, privilege escalations, and unpatched exploits if not rigorously audited. Despite the broad transition, runlevels persist in niche applications such as legacy enterprise systems, embedded devices with resource constraints, and minimal installations prioritizing simplicity over advanced features. For instance, Slackware continues to default to a SysV-style init system, appealing to users seeking a lightweight, traditional boot process. In non-Linux Unix-like systems, vendors like IBM maintain runlevel support in AIX for backward compatibility with long-standing enterprise workloads. The vast majority of Linux distributions have adopted systemd or similar modern init systems, underscoring the marginal role of pure runlevel-based setups in contemporary deployments. This shift ensures better alignment with current demands for reliability, performance, and security in diverse computing paradigms.

Systemd Targets and Compatibility

Systemd introduces targets as the modern successor to traditional runlevels, providing a more flexible and dependency-aware mechanism for managing system states. Key targets include multi-user.target, which corresponds to runlevel 3 and enables a non-graphical multi-user environment with network services active, and graphical.target, which maps to runlevel 5 and adds a graphical login interface on top of multi-user.target. These targets are defined as special unit files, typically located in /usr/lib/systemd/system/ or /lib/systemd/system/, depending on the distribution, and serve as synchronization points for pulling in related services during boot. To ensure backward compatibility with SysV-style systems, systemd creates symbolic links such as runlevel3.target pointing to multi-user.target and runlevel5.target pointing to graphical.target, allowing legacy scripts and tools to function without modification. Administrators can emulate traditional runlevel changes using commands like systemctl isolate runlevel3.target to switch to a multi-user mode, mirroring the behavior of the old init 3 command, while kernel command-line parameters (e.g., 3 or 5) automatically map to the appropriate targets. Systemd became the default init system in Fedora starting with version 15 in May 2011, and in Ubuntu with version 15.04 in April 2015, marking a shift in major distributions. By 2020, nearly all prominent Linux distributions, including Debian, Red Hat Enterprise Linux, and openSUSE, had fully transitioned to systemd as the standard, driven by its integration and performance improvements. Compared to runlevels, systemd targets offer advantages through parallel service activation, where independent units start concurrently to reduce boot times, and sophisticated dependency graphs that resolve service relationships automatically for ordered execution. Additionally, socket activation enables on-demand service startup by listening on sockets and launching daemons only when connections arrive, optimizing resource usage over the always-on model of traditional runlevels. As transitional alternatives, Upstart served as an event-based init system in distributions like Ubuntu before being superseded by systemd around 2015. OpenRC, used primarily in Gentoo, functions as a dependency-based hybrid that maintains compatibility with SysVinit while supporting parallel startups.

References

  1. [1]
    1.4. SysV Init Runlevels | Reference Guide | Red Hat Enterprise Linux
    The SysV init runlevel system provides a standard process for controlling which programs init launches or halts when initializing a runlevel.Missing: Unix- | Show results with:Unix-
  2. [2]
    boot - System bootup process based on UNIX System V Release 4
    DESCRIPTION. The bootup process (or "boot sequence") varies in details among systems, but can be roughly divided into phases controlled by the following ...Missing: like | Show results with:like
  3. [3]
    1.2.4. The /sbin/init Program | Red Hat Enterprise Linux | 4
    Runlevels are a state, or mode, defined by the services listed in the SysV /etc/rc.d/rc<x>.d/ directory, where <x> is the number of the runlevel. For more ...Missing: Unix- | Show results with:Unix-
  4. [4]
    Chapter 12. Services and Daemons | Red Hat Enterprise Linux | 6
    The runlevel command displays previous and current runlevel. In this case it is number 5, which means the system is running in a full multi-user mode with a ...Missing: Unix- | Show results with:Unix-
  5. [5]
    Chapter 10. Managing Services with systemd | 7 |
    Systemd is a system and service manager for Linux, designed to be backwards compatible with SysV init scripts, and provides parallel startup of system services.Missing: Unix- | Show results with:Unix-
  6. [6]
    runlevel(7) - Linux man page
    Runlevels. Runlevels are a concept from UNIX System V used by the init(8) daemon or other system initialisation system to define modes of system operation.
  7. [7]
    What is runlevel? | Definition from TechTarget
    Jan 12, 2024 · A runlevel is a preset operating state, defined as a single integer that could range from zero to six, in a Unix or Linux-based OS.
  8. [8]
    F.4. SysV Init Runlevels | Installation Guide | Red Hat Enterprise Linux
    The SysV init runlevel system provides a standard process for controlling which programs init launches or halts when initializing a runlevel.
  9. [9]
    3.3 About Run Levels
    Run levels allow you to start a system with only the services that are required for a specific purpose. For example, a server can run more efficiently at run ...<|separator|>
  10. [10]
    [PDF] UNIX System V manual
    PREFACE. The AT&T UNIX System V User's Manual is a two-volume reference manual that describes the operating system capabilities of the AT&T UNIX* pc.
  11. [11]
    [PDF] UNIX® System V Utilities Release Notes
    May 31, 1985 · For a comprehensive description of the software and documentation available for UNIX System V Release 3.0 for AT&T 3B2 Computers, see the ...
  12. [12]
    The UNIX System -- History and Timeline
    Since it began to escape from AT&T's Bell Laboratories in the early 1970's, the success of the UNIX operating system has led to many different versions ...Missing: runlevels | Show results with:runlevels
  13. [13]
    [PDF] IEEE standard portable operating system interface for computer ...
    IEEE Std 1003.1-1988 is the first of a group of proposed standards known col¬ loquially, and collectively, as POSIXt. The other POSIX standards are described in ...
  14. [14]
    8.5. Run Levels - Linux Foundation
    8.5. Run Levels. The following run levels are specified for use by the Default-Start and Default-Stop actions defined in Comment Conventions for Init Scripts ...
  15. [15]
    LSB Specifications - Linux Foundation
    LSB 3.1 Core was released October 27, 2005; LSB 3.1 C++ and Desktop were released April 24, 2006. An errata document was released March 19, 2007. Note: if you ...
  16. [16]
    Run Levels - Linux Foundation
    The following run levels are specified for use by the "Default-Start:" and "Default-Stop:" specifiers as defined by the section Comment Conventions for Init ...
  17. [17]
    init - man pages section 8: System Administration Commands
    Jul 27, 2022 · Run levels 0, 5, and 6 are reserved states for shutting the system down. Run levels 2, 3, and 4 are available as multi-user operating states. If ...
  18. [18]
    The /etc/inittab File (System Administration Guide
    This file defines three important items for the init process: The system's default run level. What processes to start, monitor, and restart if they terminate.
  19. [19]
    runlevel(8) - Linux manual page - man7.org
    Feb 2, 2025 · The two runlevel characters are separated by a single space character. If a runlevel cannot be determined, N is printed instead. If neither can ...
  20. [20]
    init(8) — sysvinit-core - Debian Manpages
    A runlevel is a software configuration of the system which allows only a selected group of processes to exist. The processes spawned by init for each of these ...
  21. [21]
    sysvinit - Gentoo Wiki
    sysvinit is a collection of System V-style init programs originally written by Miquel van Smoorenburg. ... Processes in a runlevel are started when init enters ...Installation · Usage · init and telinit · Shutdown and rebootMissing: concept origin
  22. [22]
    telinit(8) - Linux manual page
    ### Summary of Special Runlevels from telinit(8)
  23. [23]
    Runlevels, boot targets, shutdown, and reboot - IBM Developer
    Jun 23, 2022 · The traditional System V Runlevels define what tasks can be accomplished in the current state (or runlevel) of a Linux system. Traditional Linux ...System V Runlevels · Changing Runlevels · Systemd<|control11|><|separator|>
  24. [24]
  25. [25]
    22.5. Run Levels
    22.5. Run Levels. The following run levels are specified for use by the Default-Start and Default-Stop actions defined in Comment Conventions for Init Scripts ...
  26. [26]
    Comment Conventions for Init Scripts
    ### Summary of Init Script Conventions
  27. [27]
    Installation and Removal of Init Scripts
    ### Summary of Init Script Installation Details
  28. [28]
    Certification system | Linux Verification Center
    The LSB Certification System certifies Linux applications and distributions against the LSB standard, guides users, and lists certified products.Missing: runlevel | Show results with:runlevel
  29. [29]
    Linux Standard Base Core Specification 2.0
    These specifications are composed of two basic parts: A common specification ("LSB-generic") describing those parts of the interface that remain constant across ...
  30. [30]
    Compatibility with SysV - Freedesktop.org
    May 13, 2024 · Runlevels are supported in a limited fashion only. SysV runlevels are mapped to systemd target units, however not all systemd target units map ...<|control11|><|separator|>
  31. [31]
    System Init - The Slackware Linux Project: Configuration Help
    Multiuser mode (runlevel 2 and 3), but with the standard text-based login. This is the default runlevel in Slackware. Network Initialization. Runlevels 2, 3, ...
  32. [32]
    Handbook:Parts/Working/Initscripts - Gentoo Wiki
    Mar 11, 2025 · Note that the option given to OpenRC (boot) is the same as the sub-directory of /etc/runlevels/ that is used. Now init checks its configuration ...
  33. [33]
    OpenRC - Gentoo Wiki
    OpenRC is a dependency-based init system for Unix-like systems that maintains compatibility with the system-provided init system, normally located in /sbin/ ...
  34. [34]
    Kapitel 9. Unix Services - The Debian Administrator's Handbook
    This chapter covers basic Unix services including system boot, remote login, managing rights, administration interfaces, syslog, inetd, cron, and backup.<|control11|><|separator|>
  35. [35]
    runlevel.conf(5) — file-rc — Debian testing
    Jan 28, 2016 · After the 'S' scripts have been executed, init switches to the default runlevel as specified in /etc/inittab, usually '2'. init(8) then executes ...Missing: sysvinit | Show results with:sysvinit<|separator|>
  36. [36]
    Debian dropping the Linux Standard Base - LWN.net
    Sep 30, 2015 · The Linux Standard Base (LSB) is a specification that purports to define the services and application-level ABIs that a Linux distribution ...Missing: runlevels conformance
  37. [37]
    35.5.2. Runlevel 5 | Deployment Guide | Red Hat Enterprise Linux
    When the system boots into runlevel 5, a special X client application called a display manager is launched. A user must authenticate using the display manager.
  38. [38]
    Why is the redhat-lsb package not available in Red Hat Enterprise ...
    Jun 13, 2024 · The redhat-lsb packages were also removed from Red Hat Enterprise Linux 9 as any implementation would no longer be able to meet the LSB 5.0 specification.Missing: runlevels | Show results with:runlevels
  39. [39]
    Runlevels, shutdown, and reboot
    Jun 16, 2015 · These scripts used by init when starting the system, changing runlevels, or shutting down are typically stored in the /etc/init.d or /etc/rc.d ...
  40. [40]
    8.5. Run Levels
    However, it is not required that LSB-compliant run-time environments use these run levels; the distribution-provided install_initd script may map the run levels ...Missing: certification conformance
  41. [41]
    [PDF] UNIX® System V/386 SYSTEM ADMINISTRATOR'S GUIDE | AT&T
    While every effort has been made to ensure the accuracy of all information in this document, AT&T assumes no liability to any party for any loss or damage.
  42. [42]
    [PDF] The Design and Implementation of the NetBSD rc.d system
    d mechanism, as implemented by System V. Release 4 (SVR4). When running, the system can be in one of eight distinct run levels [3], which are distinct states in ...
  43. [43]
    Init system support in Debian - LWN.net
    Oct 31, 2018 · The problem is that two packages needed for running with System V init (sysvinit-core and systemd-shim) are not really being maintained. The ...<|control11|><|separator|>
  44. [44]
    Using Run Control Scripts - Oracle Solaris Administration
    You can run scripts in the /etc/init.d directory individually to stop system services without changing a system's run level.Missing: SysV rcN.
  45. [45]
    Run Control Scripts (System Administration Guide
    Run control scripts are also located in the /etc/init.d directory. These files are linked to corresponding run control scripts in the /etc/rc n .d directories.Missing: SysV rcN.
  46. [46]
    [PDF] Service Management Facility (SMF) in the Solaris 10 OS - filibeto.org
    the run level is the master which, when changed, also changes the milestone. Changing ...Missing: replacing | Show results with:replacing
  47. [47]
    Run Levels - Oracle Solaris Administration: Common Tasks
    A system's run level (also known as an init state) defines what services and resources are available to users. A system can be in only one run level at a time.Missing: SysV | Show results with:SysV
  48. [48]
    illumos: manual page: smf.7 - SmartOS
    the online state with all dependencies satisfied. LEGACY-RUN This state represents a legacy instance that is not managed by the service management facility ...Missing: compatibility | Show results with:compatibility
  49. [49]
    OpenIndiana How It Works, Orientation and Curiosities
    Sep 4, 2025 · Built on the foundations of the illumos kernel and leveraging advanced technologies like ZFS, DTrace, and the Service Management Facility (SMF), ...
  50. [50]
    OpenBoot PROM Features
    When the server module is at run level 0, the ok prompt appears. ... For example, if you type init 0 at the Solaris prompt the system gradually takes you to the ...Missing: OBPI | Show results with:OBPI
  51. [51]
    Default Run Level - LinuxQuestions.org
    May 1, 2007 · Solaris default runlevel (now miletone) is already 3, but there is no runlevel 4 to enable the GUI with Solaris. This is something specific to ...Missing: SysV | Show results with:SysV<|separator|>
  52. [52]
    [PDF] HP-UX System Administrator's Guide: Overview - filibeto.org
    The various run levels determine what aspects of HP-UX are running. At boot ... document to cover the actual analysis process. If you need help ...
  53. [53]
    [PDF] HP-UX Solaris Task Guide
    /sbin/init <run level> - init followed by a run level causes the system to begin executing at the specified run level. For example, init s takes the system ...Missing: trusted | Show results with:trusted
  54. [54]
    [PDF] AIX Version 7.2: Operating system management - IBM
    This document is about AIX Version 7.2, which is related to operating system management and applies to AIX Version 7.1 and subsequent releases.
  55. [55]
    System resource controller - IBM
    This article provides information about the System Resource Controller (SRC), which facilitates the management and control of complex subsystems.
  56. [56]
    System run level - IBM
    The system run level specifies the system state and defines which processes are started. It is read from /etc/inittab and can be changed with the init command.Missing: networking | Show results with:networking
  57. [57]
    Chapter 15. The FreeBSD Booting Process
    ### Summary of BSD Init Process, Runlevels, rc Scripts, Single-User Mode, and SysV Compatibility
  58. [58]
    Chapter 7. The rc.d System - NetBSD
    NetBSD uses individual scripts for controlling services, similar to what System V does, but without runlevels. This chapter is an overview of the rc.d system ...
  59. [59]
  60. [60]
    Booting - DragonFlyBSD
    Apr 11, 2020 · Upon controlled shutdown, via shutdown(8), init(8) will attempt to run the script /etc/rc.shutdown , and then proceed to send all processes the ...The DragonFly Booting Process · Synopsis · The Boot Manager and Boot...
  61. [61]
    Practical rc.d scripting in BSD | FreeBSD Documentation Portal
    A guide to writing new rc.d scripts and understanding those already written.
  62. [62]
    OpenBSD for Linux Users
    There are no SysV-style run levels. System defaults are in /etc/rc.conf . Do not edit it directly; override and localize settings in /etc/rc ...
  63. [63]
  64. [64]
    FGA: run-levels are things of the past.
    All of these years later, most parts of the System 5 world have now done away with run-levels. IBM thought that people could forget about run-levels in 1990. In ...
  65. [65]
    runlevel - Freedesktop.org
    Overview¶. "Runlevels" are an obsolete way to start and stop groups of services used in SysV init. systemd provides a compatibility layer that maps ...Missing: documentation | Show results with:documentation
  66. [66]
    Highlights from systemd v258: part one - LWN.net
    Aug 29, 2025 · Additionally, systemd v258 sheds support for System V run levels and no longer provides initctl, runlevel, and telinit commands. (These were ...
  67. [67]
    6 Best Modern Linux 'init' Systems (1992-2025) - Tecmint
    Oct 13, 2025 · While SysV init is still available and maintained, it has been largely replaced by systemd in most major distributions. Only a handful of ...
  68. [68]
    Does systemd still know about runlevels?
    Oct 2, 2014 · No. As the systemd people themselves wrote twice over, once in their telinit manual and once in their runlevel manual, runlevels are obsolete.Why can't I change runlevel from 1 to 5 in my Debian 7.8?When running to a run level does it execute previous run levels?More results from unix.stackexchange.comMissing: non- | Show results with:non-
  69. [69]
    FrequentlyAskedQuestions - Freedesktop.org
    May 13, 2024 · Q: How do I change the current runlevel? A: In systemd runlevels are exposed via "target units". You can change them like this: # systemctl isolate runlevel5. ...
  70. [70]
    Linux Detection Engineering - A Sequel on Persistence Mechanisms
    Aug 29, 2024 · A walkthrough on how threat actors establish persistence on Linux systems and how to hunt for these techniques.
  71. [71]
    What are the security implications of systemd compared to systemv ...
    Aug 17, 2017 · The attack surface of systemd is massively larger than initd - the default configuration has multiple interfaces.
  72. [72]
    systemd Saw A Record Number Of Commits In 2024 - Phoronix
    Jan 3, 2025 · Systemd in 2024 saw 1,220,052 new lines, an increase over 2023's 1,011,891 new lines of code. Plus some 1,043,929 lines removed in 2024. Yu ...
  73. [73]
    systemd.special
    ### Summary of systemd Targets Corresponding to Runlevels
  74. [74]
    systemd
    ### Summary of Compatibility with Runlevels, Symlinks like runlevel3.target, and Commands like systemctl isolate
  75. [75]
  76. [76]
    Rationale for switching from upstart to systemd? - Ask Ubuntu
    Apr 24, 2015 · The larger change that comes with Ubuntu 15.04 is the switch from upstart to systemd as the default for managing boot and system service startup.Missing: adoption timeline
  77. [77]
    systemd, 10 years later: a historical and technical retrospective
    May 4, 2020 · 10 years ago, systemd was announced and swiftly rose to become one of the most persistently controversial and polarizing pieces of software in recent history.
  78. [78]
    The systemd daemon | Administration Guide | SLED 15 SP7
    The main advantage of systemd is that it considerably speeds up boot time by parallelizing service starts. Furthermore, systemd only starts a service when it is ...
  79. [79]
    The road forward for systemd - LWN.net
    May 26, 2010 · Systemd, instead, goes for the second. Rather than concern itself with dependencies, it simply creates the sockets that system daemons will use ...
  80. [80]
    A Survey of Init Systems - » Linux Magazine
    SysVinit is built around a set of several states, or runlevels, including one for normal operations, and one for repairs usually known as single-user mode.<|separator|>