Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

It used to be that when you booted most linuxes, you would boot into runlevel 6, unless you did something during the bootloading to change the runlevel,.

The process would then look in /etc/init/rcX.d (IIRC) where X was the runlevel, and execute all the scripts begining with S in dictionary sorted order (so S01xxx ran before S20yyy).

When you went through the shutdown procedure the scripts beginning with K would be run and IIRC in reverse dictionary sort order.

Now things have changed the rcX.d directories have been moved to /etc and an /etc/rcS.d has been added, and the default runlevel is 2.

Unfortunately until now I haven't been following the changes. Can someone please describe the boot and shutdown process for runlevel 2 in present systems?

share|improve this question
    
Ummm ... you never booted into runlevel six. Some distros boot to 5, some to 3, debian and its deviants, errrh, derivatives, boot into 2, with 2 through 5 being equivalent. –  tink May 28 '13 at 0:02
add comment

1 Answer

/etc/inittab

Right out of my /etc/inittab (Fedora system):

# Default runlevel. The runlevels used 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)
# 

This line in my /etc/inittab controls my default runlevel:

id:5:initdefault:

Change it like so:

$ sudo vim /etc/inittab
id:3:initdefault:

runlevels

Your current runlevel is this:

$ runlevel
N 5

So my previous runlevel is unknown (N) and my current one is 5. Temporaily change your runlevel:

telinit 3

Take a look at this article titled: Boot-Up Manager (docs), which explains how this directory is organized under Debian.

Under Debian it shows the following runlevels:

N System bootup (NONE).
S Single user mode (not to be switched to directly)
0 halt
1 single user mode
2 - 5 multi user mode
6 reboot
share|improve this answer
    
For extra hilarity, Linux chose runlevel 5 for multi-user X-Windows. Under Solaris, runlevel 6 is reboot just like Linux, but runlevel 5 is shutdown. I can only imagine how many Linux folks new to Solaris have had fun with that. –  kurtm Oct 13 '13 at 16:32
    
note for future visitors: this is an old Fedora, newer releases have systemd –  strugee Dec 28 '13 at 11:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.