4.2.5. Init run levels
The idea behind operating different services at different run
levels essentially revolves around the fact that different systems
can be used in different ways. Some services cannot be used until
the system is in a particular state, or mode, such as
being ready for more than one user or having networking
There are times in which you may want to operate the system in a
lower mode. Examples are fixing disk corruption problems in run
level 1 so no other users can possibly be on the system, or leaving
a server in run level 3 without an X session running. In these
cases, running services that depend upon a higher system mode to
function does not make sense because they will not work correctly
anyway. By already having each service assigned to start when its
particular run level is reached, you ensure an orderly start up
process, and you can quickly change the mode of the machine without
worrying about which services to manually start or stop.
Available run levels are generally described in /etc/inittab, which is partially shown below:
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
# Default run level. The run levels are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS
# (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
Feel free to configure unused run levels (commonly run level 4)
as you see fit. Many users configure those run levels in a way that
makes the most sense for them while leaving the standard run levels
as they are by default. This allows them to quickly move in and out
of their custom configuration without disturbing the normal set of
features at the standard run levels.
If your machine gets into a state where it will not boot due to
a bad /etc/inittab or will not let you
log in because you have a corrupted /etc/passwd file (or if you have simply forgotten
your password), boot into single-user mode.
When you are working in text mode because you didn't get
presented a graphical login screen on the console of your machine,
you can normally switch to console 7 or up to have a graphical
login. If this is not the case, check the current run level using
the command who -r.
If it is set to something else than the original default from
/etc/inittab, chances are that the system
does not start up in graphical mode by default. Contact your system
administrator or read man init in that case.
Note that switching run levels is done preferably using the
telinit command; switching from a text to a
graphical console or vice versa does not involve a run level
The discussion of run levels, scripts and configurations in this
guide tries to be as general as possible. Lots of variations exist.
For instance, Gentoo Linux stores scripts in /etc/run levels. Other systems might first run
through (a) lower run level(s) and execute all the scripts in there
before arriving at the final run level and executing those scripts.
Refer to your system documentation for more information. You might
also read through the scripts that are refered to in /etc/inittab to get a better comprehension of what
happens on your system.