On Tue, 17 Jun 2003, Matthew Melvin wrote:

> You seem to have it pretty much sus'ed excepted for the roll of inittab in
> run level S.  Yes init still looks in /etc/inittab when going to run level S
> but if it doesn't find an entry, or the inittab can't be opened then it init
> acts as if it had read..
> 
> ~~:S:wait:/bin/sh

ah, this is useful information, and is not mentioned *explicitly* in the
man page for "init", which states simply that "Runlevel S or s bring the
system to single user mode and do not require an /etc/inittab file. In
single user mode, a root shell is opened on /dev/console."

good to know.
 
> ... from the file.  So inittab is not required but nor is it ignored.  On
> some of my older systems I've overiden this with...
> 
> ~:S:wait:/sbin/consolechooser
> 
> ... where consolechooser is a script I wrote to deal with some serial
> consoles that wouldn't behave themselves.
> 
> With runlevel 1 your box still needs to have some basic funtionality, in run
> level S, nothing really needs to work except /sbin/init and /bin/sh... it's
> basically one step up from booting with init=/bin/sh ... using runlevel S 
> instead of the init= hack (assuming S works) really just means you don't 
> have to reboot the system to go back to a 'real' run level.

just to clarify a few things i probably didn't cover clearly in my 
first post, it's fairly obvious what happens when you move between
numbered run levels -- any of 1,2,3,5 -- with the "init" command.
if you're, for example, in level 3, and type "init 2", init consults
/etc/inittab, which causes all of the K and S scripts in /etc/rc2.d
to be invoked, etc, etc.

in addition, there is the "runlevel" command, which prints the previous
and current runlevels, so that if you just changed from 3 to 2, the
output will be "3 2".  if you just booted, though, the runlevel output
will be something like "N 3", since there *was* no previous runlevel.

however, run level "s" (or "S") is different since it isn't defined
in /etc/inittab.  i was initially a bit confused when, from run level 3,
i typed "init 1" and, after all the service shutdown, the runlevel
command printed "1 S".  that was a bit odd, i thought, since i never
*asked* for single user mode, but it became clear when you look in
/etc/rc1.d and notice that, after all the K scripts, the two S
scripts are S00single (go to single user mode) and S17keytable.
so, technically, going to run level 1 does take you eventually to
single-user mode.

but it's not clear if it's a good idea, from say run level 3, to type
"init s" to go directly to single-user mode, since none of the /etc/rc1.d
scripts will be run, and all your services will still be running (go ahead
and try it, it doesn't seem to hurt anything).  from what i read, going
directly to single-user mode in this way is not recommended, and is
supposed to be used only by other scripts or utilities.

when you *boot*, however, it's fine to choose either run level 1
or, in the more extreme case if you've toasted your /etc/inittab,
run level "s".

ok, i think it all makes sense now.

rday

--

Robert P. J. Day
Eno River Technologies
Unix, Linux and Open Source training
Waterloo, Ontario

www.enoriver.com


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to