Runlevel

from Wikipedia, the free encyclopedia

The term runlevel describes an operating state of computers. It is particularly important when starting the operating system . The runlevel is mainly known in Unix-like operating systems, but is also present in other operating systems.

General

Many operating systems go through several graded system states when they are started ( booting ) or start in a certain state, the runlevel. Certain system services are assigned to each runlevel , which are started as processes in a well-defined order within the operating system when the system is booted. In this way, resources of the computer are put into operation in stages. When the operating system is terminated ( shutdown ), the runlevels are run through in reverse order, the running processes are terminated in stages until the computer can be switched off. You can also switch directly from one runlevel to another.

Runlevel is mainly known from the different Unix systems such as Solaris (before Solaris 10), GNU / Linux , HP-UX or AIX . But even in Windows , the start options Safe Mode , Safe Mode with Network or Windows Normal Start in the Windows boot menu each correspond to exactly one run level . Solaris 10 uses runlevel only in a rudimentary way, the main system control is done there by the Service Management Facility (SMF).

The idea of ​​the different run levels is to provide security levels in which only certain system processes are active. This is important if, for example, a system is infected by computer viruses and is supposed to run without a network connection.

Unlike the on System V -based operating systems knows FreeBSD no run levels, but stops at the traditional init of BSD firmly.

Example Linux

The runlevel is selected by a command line or the / etc / inittab file , but not necessarily defined there, and everything else can vary greatly between the various Linux distributions . Runlevels do not have to be continuously defined and do not all have to be different.

When changing to a runlevel, the services or processes named in its definition are automatically started or stopped. A conceivable configuration is given in the following table:

Runlevel description
0 Shut down. All network connections are closed, file buffers are written, mounts on partitions are removed (i.e. the volumes integrated in the directory tree are unmounted).
S. Single user run level; Lowest system state for maintenance work, in which only system resources such as hard disks or file systems are active.
1 Single user operation without a network with only local resources. Identical to 'S' in many implementations.
2 Local multi-user operation without a network with only local resources. With some Linux distributions (e.g. Debian) the network is also configured in runlevel 2.
3 Network operation, resources accessible via the network can be used, a graphical user interface is not available. Firewalls should be activated.
4th Usually not defined. But can be used for various services.
5 As in 3, the graphical user interface is also provided.
6th Reboot. All network connections are closed, file buffers are written, mounts on partitions are removed.

The init program mentioned above can also be used by privileged users to change the runlevel. According to the levels shown in the table, the system can be shut down with / sbin / init 0 or rebooted with / sbin / init 6 . To determine the current runlevel, most distributions use the / sbin / runlevel command and / or the RUNLEVEL environment variable (or who -r according to System V ).

Example Solaris

All system services are also specified in the / etc / inittab file . In contrast to Linux, the following definitions apply to the individual runlevels under Solaris:

Runlevel description
0 Shutdown run level, PROM mode
S. Single user run level; Similar to runlevel 1, but only the most necessary file systems are mounted ("/" and "/ usr") in order to avoid changes to the system during maintenance work
1 Administration runlevel (see Linux)
2 Multi-user run level (see Linux)
3 Multi-user run level with network (see Linux)
4th Custom runlevel (see Linux)
5 Poweroff runlevel; similar to runlevel 0, but the power supply is switched off if this is supported.
6th Reboot run level (see Linux)
ABC Special runlevel; these are started in addition to the active run levels
Q This parameter is used to read in / etc / inittab again in order to make changes without rebooting. However, Q is not a special run level.

Individual evidence

  1. System startup . In: FreeBSD Quickstart Guide for Linux ® Users . FreeBSD Foundation . Retrieved December 2, 2015.
  2. Run levels . In: Linux System Administrator's Guide . Linux Documentation Project . Retrieved December 2, 2015.
  3. An introduction to services, runlevels, and rc.d scripts . Linux Foundation . January 11, 2006. Retrieved December 2, 2015.