Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

According to Wikipedia, 'S' is supposed to be a standard runlevel: "Single-User Mode". But if I'm not mistaken, the Single-User mode on Debian is Runlevel 1. One Debian article I found claims, that 'S' is a runlevel "that the system uses on it's way to another runlevel". Interesting...

Actually, I had always pretty much ignored this runlevel so far, but today I played around with Firestarter (yes, really, an end-user firewall) just because I was curious, which firewall rules it would generate. But then I noticed, that it creates a startup hook in /etc/rcS.d, and I wondered, if my firewall script should maybe have that, too?

Update

Now I'm even more interested in knowing what it actually is on Debian/Ubuntu, because the Shorewall package (which is a strongly "Debianized" package) also creates its (only!) startup hook in rcS.d!

share|improve this question

3 Answers 3

I look at the runlevels in this way:

 S - true single user mode usually drops you into a minimal root shell
 1 - Administrative mode, you get a standard login request before access
 2 - Multi-user without TCP/IP networking -- could use serial ports for other logins
 3 - Multi-user with TCP/IP networking and text 
 4 - To be determined by the system owner
 5 - Multi-User with TCP/IP networking and graphic console 
 6 - reboot
 0 - shutdown and power down

Thus, a firewall is really needed if TCP/IP is up and running and that generally happens only in Init State 3.

share|improve this answer
    
This whole runlevel concept is a legacy thing from the past. Nowadays it is usually single user mode (for maintenance) and some other normal mode (like 2 or 5 depending on the distro) is used. I do not really see a use case for anything else. –  cstamas Jul 14 '11 at 20:55
    
Actually worse yet, the newest distributions are doing away with run levels all together (currently being support as legacy matters) and going to named states with dependancies under them (see Fedora 15). –  mdpc Jul 14 '11 at 23:07

S is for single user mode.

http://wiki.debian.org/RunLevel

share|improve this answer
    
So if a script only has a startup hook in runlevel S (like e.g. Shorewall), and I boot to runlevel '2', will the boot sequence start the script? –  Chris Lercher Jul 15 '11 at 16:30
    
In Linux, if your default state (as described in /etc/inittab) is N then unlike UNIX, only the 'S' items in /etc/rc.d/rcN.d (this location may vary dependent on Linux distribution) will be executed during startup, no other init directory will be used. –  mdpc Jul 15 '11 at 17:22
    
You typically set your default runlevel in inittab. The numbers increment. So, for your example, if your init is configured in S only that is the same as runlevel 1. On boot, your system will start at runlevel 1 and increase running all init scripts for that level, then increment the runlevel and repeat until it gets to the default runlevel specified in inittab. Here that's two. So whatever was configured to turn on in either 1 or 2 will be on. –  dmourati Jul 15 '11 at 18:20
    
Please note, that my question is specific to Debian/Ubuntu! I just tried the following: I put a simple script in /etc/rcS.d and /etc/rc2.d, each writing a short message (with a timestamp) to a logfile. Result: After boot, I have a log message for rcS, and 5 seconds later a log message for rc2. –  Chris Lercher Jul 15 '11 at 19:15
    
To change the default runlevel the system will boot into, modify the variable DEFAULT_RUNLEVEL in file /etc/init/rc-sysinit.conf. For example, to make the system boot by default to single user mode, set: env DEFAULT_RUNLEVEL=1 –  dmourati Jul 15 '11 at 21:02

In addition to the answer provided by mdpc, In run level 1, no daemons (services) are started.

share|improve this answer

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.