Runlevel
A runlevel is a mode of operation in the computer operating systems that implement 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.
A runlevel defines the state of the machine after boot. Different runlevels are typically assigned to the single-user mode, multi-user mode without network services started, multi-user mode with network services started, system shutdown, and system reboot system states. The exact setup of these configurations varies between operating systems and Linux distributions. For example, runlevel 4 might be a multi-user GUI no-server configuration on one distribution, and nothing on another. Runlevels commonly follow the general patterns described in this article; however, some distributions employ certain specific configurations.
In standard practice, when a computer enters runlevel zero, it halts, and when it enters runlevel six, it reboots. The intermediate runlevels differ in terms of which drives are mounted and which network services are started. Default runlevels are typically 3, 4, or 5. Lower runlevels are useful for maintenance or emergency repairs, since they usually don't offer any network services at all. The particular details of runlevel configuration differ widely among operating systems, and also among system administrators.
In various Linux distributions, the traditional script used in the Version 7 Unix was first replaced by runlevels and then by systemd states on most major distributions.
Standard runlevels
Linux
Although systemd is, as of 2016, used by default in most major Linux distributions, runlevels can still be used through the means provided by the sysvinit project. After the Linux kernel has booted, the program reads the file to determine the behavior for each runlevel. Unless the user specifies another value as a kernel boot parameter, the system will attempt to enter the default runlevel.Linux Standard Base specification
Systems conforming to the Linux Standard Base need not provide the exact run levels given here or give them the meanings described here, and may map any level described here to a different level which provides the equivalent functionality.ID | Name | Description |
0 | Halt | Shuts down the system. |
1 | Single-user mode | Mode for administrative tasks. |
2 | Multi-user mode | Does not configure network interfaces and does not export networks services. |
3 | Multi-user mode with networking | Starts the system normally. |
4 | Not used/user-definable | For special purposes. |
5 | Start the system normally with appropriate display manager | Same as runlevel 3 + display manager. |
6 | Reboot | Reboots the system. |
Slackware Linux
uses runlevel 1 for maintenance, as on other Linux distributions; runlevels 2, 3 and 5 identically configured for a console ; and runlevel 4 adds the X Window System.ID | Description |
0 | Halt |
1 | Single-user mode |
2 | Unused but configured the same as runlevel 3 |
3 | Multi-user mode without display manager |
4 | Multi-user mode with display manager |
5 | Unused but configured the same as runlevel 3 |
6 | Reboot |
Gentoo Linux
Unix
System V Releases 3 and 4
Solaris
Starting from Solaris 10, SMF is used instead of SVR4 run levels. The latter are emulated to preserve compatibility with legacy startup scripts.ID | Description |
0 | Operating system halted; drop to OpenBoot prompt |
S | Single-user mode with only root filesystem mounted -- Solaris 10+: svc:/milestone/single-user |
1 | Single-user mode with all local filesystems mounted |
2 | Multi-user mode with most daemons started – Solaris 10+: svc:/milestone/multi-user |
3 | Multi-user mode; identical to 2, with filesystems exported, plus some other network services started. -- Solaris 10+: svc:/milestone/multi-user-server |
4 | Alternative Multi-user mode, User-definable |
5 | Shut down, power-off if hardware supports it |
6 | Reboot |
HP-UX
AIX
does not follow the System V R4 runlevel specification, with runlevels from 0 to 9 available, as well as from a to c. 0 and 1 are reserved, 2 is the default normal multi-user mode and runlevels from 3 to 9 are free to be defined by the administrator. Runlevels from a to c allow the execution of processes in that runlevel without killing processes started in another.ID | Name | Description |
0 | reserved | |
1 | reserved | |
2 | Normal Multi-user mode | default mode |
The S, s, M and m runlevels are not true runlevels, but are used to tell the init command to enter maintenance mode. When the system enters maintenance mode from another runlevel, only the system console is used as the terminal.