What are and how to change Runlevels

tux.png

Many people get confused when trying to boot in to a runlevel other than runlevel 5, for example runlevel 3, disabiling the GUI front end with which most users are familiar. Hopefully this howto will help answer the questions “How do I disable X” or “How do I boot without X” or even “How do I get to single user mode.”

One requirement of this is to have an understanding of what runlevels are, how changing runlevels will impact your system, and what services may or may not be started. In general this is beyond the scope of this document but I will give a quick run down of things as listed in /etc/inittab.

Just a warning, this does not apply to Ubuntu as Ubuntu focuses on Upstart.

Runlevels

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 or Admin
5 – X11 (desktop environments)
6 – reboot (Do NOT set initdefault to this)

The most commonly used runlevels in Linux are 0, 1, 3, 5 and 6. As you can see you use runlevels everytime you shutdown (runlevel 0) or reboot (runlevel 6) your machine. Most users boot to runlevel 5 with X11 support and a GUI login. Some however, boot to Full multiuser mode (runlevel 3) and may choose to “startx” manually once logged in. Single user mode (runlevel 1) can be very handy if you have forgotten your root password or are having trouble booting for any number of reasons. Full multi user mode (runlevel 3) is desirable when you are having trouble with X11 and would like to repair your xorg configuration or when running a server where you do not want the added overhead of having X running.

Editing /etc/inittab to change your default runlevel

Open /etc/inittab in your favorite editor (I use nano).

(as root): nano /etc/inittab

On about line 18 you will see a line like the one shown below.

id:5:initdefault:

You simply change the “5″ in this case to the runlevel you desire. Save the file and exit. I cannot stress enough, do not set this to 6 or 0.

Changing your current run level

You can change runlevels using the telinit or init commands as in the example below.

(as root:) telinit 3

Source

No Posts Found

Comments are closed.