[Pkg-sysvinit-devel] Re: init do not pass correct PREVLEVEL when switching from runlevel S

Miquel van Smoorenburg miquels at cistron.nl
Thu Sep 14 14:00:30 UTC 2006


On Thu, 2006-09-14 at 08:05 -0300, Henrique de Moraes Holschuh wrote:
> On Thu, 14 Sep 2006, Petter Reinholdtsen wrote:
> > [Henrique de Moraes Holschuh]
> > > S has never been the single user runlevel.  WTF is init doing with S that
> > > got you worried?
> > 
> > It is storing 'S' in the runlevel variable, and passing it as
> > RUNLEVEL=S when you do 'telinit s', and 'telinit 1' is not the same as
> > 'telinit s'.  For 'telinit 1', it runs the stop scripts before asking
> > for the password, for 'telinit s', it just ask for the password.
> 
> Yikes.  Let's fix that.  Is that a new regression, or something that has
> been there since long ago?  Is Miquel still around here?  He should know
> better than we do, he's the living memory of sysv-init.

Yup, you should not use 'telinit s'.

What sysvinit does (and the script around it) might not always make
sense, but it's the same as what Solaris did at the time.

> What init is doing right now *is* correct, btw.  It just was never meant to
> happen (it should not allow anyone to really request a switch to runlevel S
> directly after the initial bootstrap).

Right.

> Now, we need to decide how to go about it.  Documentation suggests I was
> slightly mistaken (the system CAN be in the "S" runlevel, but you are meant
> to get to it only through a kernel boot, or from runlevel "1" -- so it is
> runlevel "1" that you are never into, you just go through it).
> 
> This is also why runlevel 1 has only stop scripts, and runlevel S has only
> start scripts.   It is fucked up, but it makes sense.

The scripts in /etc/rcS.d are only run at system boot time. In fact, at
"sysinit" time (see /etc/inittab). At that time, the runlevel actually
is 'N' (for None yet).

Don't confuse /etc/rcS.d with runlevel S. Just read /etc/inittab.

> The fix is to teach telinit that "telinit S" always mean "telinit 1" unless
> you are booting, or going from runlevel 1 to runlevel S, I think.
> 
> > This made me confused, and I started reading the source.  Our init
> > implementation uses 'S' as the runlevel code for single user, and do
> > not understand that '1' and 'S' are equivalent.  See also #372669 and
> > #387351, which got me started on this testing.
> 
> 1 and S are not equivalent runlevels (inside init), but they're supposed to
> be equivalent in telinit's human interface (which is...  misleading to say
> the least).

There is something to be said for doing

	if (wanted_level == 's' && current_level > '1' && current_level < '6')
wanted_level = '1' ..

> Heh, you read the paper, you know how I'd suggest we go about it.

I've been reading the Ubuntu upstart docs .. I think I like it.

Mike.




More information about the Pkg-sysvinit-devel mailing list