A note from go2linux

April 22, 2008

Run Levels of Debain or ubuntu with Cent or Fedora

There are six different runlevels in Linux, there could be more than six, but for compatibility reasons six are the default.

I have used RedHat and Debian based Linux, more specifically Fedora
and Ubuntu and Debian itself, I have noticed that there is a difference
in the runlevels on this different Linux distributions.

Well but first let’s define the runlevels:

Runlevels in Linux are seven and they are:

– 0 = halt
– 1 = single user
– 2 = CLI, multi-user, no net
– 3 = CLI, multi-user, networked
– 4 = open
– 5 = GUI, multi-user, networked
– 6 = reboot

You can define more of them if you want, but whit this should be
enough, a runlevel will define which software to start when you enter
in that specific runlevel.

For example if you go to runlevel 0, the computer will halt, and probable turn off (If it is a modern computer).

When you enter a specific runlevel, Linux will run some scripts that are located at:

/etc/rc0.d Run level 0
/etc/rc1.d Run level 1
/etc/rc2.d Run level 2
/etc/rc3.d Run level 3
/etc/rc4.d Run level 4
/etc/rc5.d Run level 5
/etc/rc6.d Run level 6

So you can (If you know what you are doing) modify the way each runlevel works, you can add new scripts to any runlevel using update-rc.d command.

Now if you are switching from RedHat to Debian or the other way, you
should know about a little difference (I do not know why) in the way
the manage runlevels.

In Debian the default is 2, and it is usually a CLI multiuser mode,
and 5 is the Graphical runlevel, in Redhat systems the runlevel 3 is
the multiuser CLI, and the graphical is also 5 as in Debian.

Debian Define its runlevels this way

0 — System Halt
1 — Single user
2 — Full multi-user mode (Default)
3-5 — Same as 2
6 — System Reboot

And RedHat defines its runlevels this way.

0 — Halt
1 — Single-user mode
2 — Not used (user-definable)
3 — Full multi-user mode
4 — Not used (user-definable)
5 — Full multi-user mode (with an X-based login screen)
6 — Reboot

So, as you can see 2 is unused, and it is user-definable, actually anyone are user-definable.

To change from one runlevel to another, use the telinit command, read the man page for more info, and use with care.

Advertisements

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: