What is “runlevel”?

reference link:http://en.wikipedia.org/wiki/Runlevel

The term runlevel refers to a mode of operation in one of the computer operating systems that implement Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six; though up to ten, from zero to nine[citation needed], 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:

The exact setup of these configurations will vary from OS to OS, and from one Linux distribution to another. For 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. It is best to consult the particular 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.

Debian GNU/Linux

Debian, as well as most of the distributions based on it, does not make any distinction between runlevels 2 to 5.

Debian GNU/Linux runlevels[3]
ID Description
S Only run on boot (replaces /etc/rc.boot)
0 Halt
1 Single-user mode
25 Full Multi-user with console logins and display manager if installed
6 Reboot

Ubuntu

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

Ubuntu runlevels[4]
Code Information
0 Halt
1 Single-user mode
2 Graphical multi-user with networking
3-5 Unused but configured the same as runlevel 2
6 Reboot

Specific to Ubuntu OS

To see the current (and previous) runlevel:

runlevel

To switch runlevels:

sudo init $runlevel

For example, to reboot:

sudo init 6

The init you are reading about was replaced by upstart starting with Edgy Eft 6.10; and, one of the programs provided by upstart is its own implementation of init. Here are the docs for 10.04.

To change the default runlevel, use your favorite text editor on /etc/init/rc-sysinit.conf…

sudo vim /etc/init/rc-sysinit.conf

Change this line to whichever runlevel you want…

env DEFAULT_RUNLEVEL=2

Then, at each boot, upstart will use that runlevel.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s