Runlevel
Encyclopedia
The term runlevel refers to a mode of operation in one of the computer operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s that implement Unix System V-style init
Init
init is a program for Unix-based computer operating systems that spawns all other processes. It runs as a daemon and typically has PID 1. The boot loader starts the kernel and the kernel starts init...

ialization. Conventionally, seven runlevels exist, numbered from zero to six; though up to ten, from zero to nine, may be used. S is sometimes used as a synonym for one of the levels. Only one "runlevel" is executed on bootup - run levels are not executed sequentially, i.e. either runlevel 2 OR 3 OR 4 is executed, not 2 then 3 then 4.

"Runlevel" defines the state of the machine after boot. Different runlevels are typically assigned to:
  • single-user mode
  • multi-user mode without network services started
  • multi-user mode with network services started
  • system shutdown
  • system reboot


The exact setup of these configurations will vary from OS to OS, and from one Linux distribution to another. Example, runlevel 4 might be multi-user, GUI, no-server on one distribution, and nothing on another. Note the difference in the Red Hat and Slackware distributions charted in this article. However, "runlevels" do commonly follow patterns described in this article. When installing Linux, it is best to consult that distribution's available user guides.

In standard practice, when a computer enters runlevel zero, it halts, and when it enters runlevel six, it reboots. The intermediate runlevels (1-5) differ in terms of which drives are mounted, and which network services are started. Default runlevels are typically 3, 4, or 5. Lower run levels 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.

The runlevel system replaced the traditional /etc/rc script used in Version 7 Unix
Version 7 Unix
Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system. V7, released in 1979, was the last Bell Laboratories release to see widespread distribution before the commercialization of Unix by AT&T in the early 1980s...

.

Standard runlevels

Standard runlevels
ID Name Description
0 Halt Shuts down the system.
S Single-User Mode
Single user mode
Single user mode is a mode in which a multiuser computer operating system boots into a single superuser. It is mainly used for maintenance of multi-user environments such as network servers. Some tasks may require exclusive access to shared resources, for example running fsck on a network share...

Does not configure network interface
Network interface
Network interface may refer to:* Network interface controller, the device a computer uses to connect to a computer network* Network interface device, a demarcation point for a telephone network...

s or start daemons
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

.
6 Reboot Reboots the system.


= Almost all systems use runlevel 1 for this purpose. This mode is intended to provide a safe environment to perform system maintenance. Originally this runlevel provided a single terminal (console) interface running a root
Superuser
On many computer operating systems, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator or supervisor....

 login shell. The increasing trend towards physical access to the computer during the boot
Booting
In computing, booting is a process that begins when a user turns on a computer system and prepares the computer to perform its normal operations. On modern computers, this typically involves loading and starting an operating system. The boot sequence is the initial set of operations that the...

 process has led to changes in this area.

Linux

The Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 operating system can make use of runlevels through the programs of the sysvinit project. After the Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

 has booted, the init program reads the /etc/inittab 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 (start) the default runlevel.

Typical Linux runlevels

Major Linux distribution
Linux distribution
A Linux distribution is a member of the family of Unix-like operating systems built on top of the Linux kernel. Such distributions are operating systems including a large collection of software applications such as word processors, spreadsheets, media players, and database applications...

s agreed to define the following runlevels as part of the Linux Standard Base
Linux Standard Base
The Linux Standard Base is a joint project by several Linux distributions under the organizational structure of the Linux Foundation to standardize the software system structure, including the filesystem hierarchy, used with Linux operating system...

 specification:
Typical Linux runlevels
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. ( with GUI ) As runlevel 3 + display manager.
6 Reboot Reboots the system.


= The additional behavior of this runlevel varies greatly. All distributions provide at least one virtual terminal. Some distributions start a login shell as the superuser
Superuser
On many computer operating systems, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator or supervisor....

; some require correctly entering the superuser's password first; others provide a login prompt, allowing any user access.


= In some cases, runlevels 2 and 3 function identically; offering a Multi-User Mode with Networking.

Debian Linux

Debian
Debian
Debian is a computer operating system composed of software packages released as free and open source software primarily under the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential...

, as well as most of the distributions based on it, like early Ubuntu, does not make any distinction between runlevels 2 to 5.
Debian Linux runlevels
ID Description
0 Halt
1 Single-User mode
2-5 Full Multi-User with console logins and display manager if installed
6 Reboot

Ubuntu

Ubuntu
Ubuntu (operating system)
Ubuntu is a computer operating system based on the Debian Linux distribution and distributed as free and open source software. It is named after the Southern African philosophy of Ubuntu...

 6.10 (Edgy Eft) and later contain Upstart
Upstart
Upstart is an 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....

 as a replacement for the traditional init-process, but they still use the traditional init scripts and Upstart's SysV-rc compatibility tools to start most services and emulate runlevels.

Red Hat Linux and Fedora

Red Hat
Red Hat
Red Hat, Inc. is an S&P 500 company in the free and open source software sector, and a major Linux distribution vendor. Founded in 1993, Red Hat has its corporate headquarters in Raleigh, North Carolina with satellite offices worldwide....

 as well as most of its derivatives (such as CentOS
CentOS
CentOS is a free operating system based on Red Hat Enterprise Linux . It exists to provide a free enterprise class computing platform and strives to maintain 100% binary compatibility with its upstream distribution...

) uses runlevels like this :
Red Hat Linux/Fedora runlevels
ID Description
0 Halt
1 Single-User mode
2 Multi-user mode console logins only (without networking)
3 Multi-User mode, console logins only
4 Not used/User-definable
5 Multi-User mode, with display manager as well as console logins (X11)
6 Reboot


Which services are started in which runlevels can be managed with the chkconfig tool, which keeps its configuration settings under /etc/rc.d/. /sbin/chkconfig --list lists all the services controlled by chkconfig and whether they are on/off for each runlevel. Setting a service A controlled by chkconfig, for levels X, Y and Z is as simple as /sbin/chkconfig --level XYZ A on

SUSE Linux

SUSE uses a similar setup to Red Hat:
SUSE Linux runlevels
ID Description
0 Halt
1 or S Single-User mode
2 Multi-User mode without networking
3 Multi-User mode, console logins only
4 Not used/User-definable
5 Multi-User mode with display manager
6 Reboot


The services that run under a specific runlevel can be modified with YaST | System Services (runlevel) or with chkconfig command like the Red Hat based distributions.

Slackware Linux

Slackware Linux uses runlevel 1 for maintenance, as on other Linux distributions; runlevels 2, 3 and 5 identically configured for a console (with all services active); and runlevel 4 adds the X Window System.
Slackware Linux runlevels
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

Arch Linux

Arch Linux
Arch Linux
Arch Linux is an independently developed, Linux-based operating system for i686 and x86-64 computers. It is composed predominantly of free and open source software, and supports community involvement....

 runlevels
ID Description
0 Halt
1 Single-User (Maintenance Mode)
2 Not used
3 Multi-User
4 Not used
5 Multi-User with X11
6 Reboot

Gentoo Linux

Gentoo Linux
Gentoo Linux
Gentoo Linux is a computer operating system built on top of the Linux kernel and based on the Portage package management system. It is distributed as free and open source software. Unlike a conventional software distribution, the user compiles the source code locally according to their chosen...

 runlevels
ID Description
0 Halt
1 or S Single-User mode
2 Multi-User mode without networking
3 Multi-User mode
4 Aliased for runlevel 3
5 Aliased for runlevel 3
6 Reboot

System V Releases 3 and 4

System V runlevels
ID Description
0 Shut down system, power-off if hardware supports it (only available from the console)
1 Single-User mode, all filesystems unmounted but root, all processes except console processes killed
2 Multi-User mode
3 Multi-User mode with RFS
Remote File System
The Remote File System was a distributed file system developed by AT&T in the 1980s. It was first delivered with UNIX System V Release 3 .Compared to NFS it made quite different design decisions...

 (and NFS in Release 4) filesystems exported
4 Multi-User, User-definable
5 Halt the operating system, go to firmware
6 Reboot
s, S Identical to 1, except current terminal acts as the system console

Solaris

Solaris
Solaris Operating System
Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010....

 runlevels
ID Description
0 Operating system halted; (SPARC
SPARC
SPARC is a RISC instruction set architecture developed by Sun Microsystems and introduced in mid-1987....

 only) drop to OpenBoot
Open Firmware
Open Firmware, or OpenBoot in Sun Microsystems parlance, is a standard defining the interfaces of a computer firmware system, formerly endorsed by the Institute of Electrical and Electronics Engineers . It originated at Sun, and has been used by Sun, Apple, IBM, and most other non-x86 PCI chipset...

 prompt
S Single-User mode with only root filesystem mounted (as read-only)
1 Single-User mode with all local filesystems mounted (read-write)
2 Multi-User mode with most daemons started
3 Multi-User mode; identical to 2 (runlevel 3 runs both /sbin/rc2 and /sbin/rc3), with filesystems exported, plus some other network services started.
4 Alternative Multi-User mode, User-definable
5 Shut down, power-off if hardware supports it
6 Reboot

HP-UX

HP-UX
HP-UX
HP-UX is Hewlett-Packard's proprietary implementation of the Unix operating system, based on UNIX System V and first released in 1984...

 runlevels
ID Description
0 System halted
S Single-User mode, booted to system console only, with only root filesystem mounted (as read-only)
s Single-User mode, identical to S except the current terminal acts as the system console
1 Single-User mode with local filesystems mounted (read-write)
2 Multi-User mode with most daemons
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

 started and Common Desktop Environment
Common Desktop Environment
The Common Desktop Environment is a desktop environment for Unix and OpenVMS, based on the Motif widget toolkit.- Corporate history :...

 launched
3 Identical to runlevel 2 with NFS exported
4 Multi-User mode with VUE
VUE
In computing, Visual User Environment was Hewlett-Packard's Desktop environment for the X Window System. It was a rival and precursor to the Open Group's CDE. Work began on VUE in 1988 at Apollo Computer for use with Domain/OS, as an alternative to Apollo's standard DM and wmgr...

 started instead of CDE
5, 6 Not used/User-definable

FreeBSD, OpenBSD and NetBSD

The BSD variants don't use the concept of run levels, although on some versions init(8) provides an emulation of some of the common run levels.

AIX

AIX
AIX operating system
AIX AIX AIX (Advanced Interactive eXecutive, pronounced "a i ex" is a series of proprietary Unix operating systems developed and sold by IBM for several of its computer platforms...

 does not follow the System V R4 (SVR4) run level specification, with run levels 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 run levels from 3 to 9 are free to be defined by the administrator. Run levels from a to c allow the execution of processes in that run level without killing processes started in another.
AIX runlevels
ID Name Description
0 reserved
1 reserved
2 Normal Multi-User mode default mode

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK