[Bug 56] New: Needless special handling of runlevels 0/6
lexfiend at usa.net
Sat May 26 10:44:02 PDT 2001
On Sat, 26 May 2001, Gerard Beekmans wrote:
> The reason why we have a seperation of S and K links in the rc0.d and
> rc6.d directories is that we want to seperate the killing of daemons
> and other misc things. The whole symlink business with those numbers
> is quite fragile and the current setup lessens the risc of you having
> the system unmount file systems before all daemons are killed, or
> worse reboot before all daemons are killed, and file systems are
I think we're on different wavelengths. The S/K issue here isn't one of
script ordering -- a simple 'ls /etc/rc0.d' immediately tells you the
order of execution, since K scripts are always run before S anyway.
Anyone who boo-boos /that/ will (hopefully) learn from experience.
The issue is one of semantics, expectations and unpleasant surprises.
Here's an example:
Suppose I have a simple HA setup, with two servers connected by a serial
cable. On a runlevel 0 or (possibly) 6 transition, I want to send a
signal to the other server to take over all my services, so I write a
failover script to do so.
Since it tells the other server what to do, the script reasonably sends a
"start your takeover" signal on a "start" argument, and "thanks, I'm
coming back" on a "stop". Equally reasonably, I link it in to rc0.d and
rc6.d as S850failover, so that the signal gets sent after all my services
have died, but before I start umounting (I want to log this occurrence).
Now, if I set the server up myself and my memory's still good, I might
know I'm setting myself up for a fall. But someone else did the initial
setup, and so HA fails -- I shut down one server, and the other doesn't
take over. Lots of head-scratching and hours of debugging later, I find
out that the script always gets a "stop" argument.
Or I may not, since it may never occur to me that an S script could
possibly get any other argument than "start". Checking one's assumptions
at the door is far, far easier said than done, after all.
> By the way, LFS isn't the only system that does it. I know for a fact
> that Debian does it the same way and I believe there are others that
> do similar things.
I'll take your word for it, since I've never used Debian. On the other
hand, I know Solaris doesn't. Neither does ROCK Linux, which seems to be
the closest distro philosophically to LFS. And, as you noted, no
RedHat-derived distro does, either.
> There's no real sysv standard, so everybody more or less implements
> what makes sense to him/her.
OK, but the K/S semantics haven't changed in all these years, and making
them irrelevant for a halt/reboot, where any errors related to this
misconception are quickly blotted out by a POST screen, is IMO not the
best thing to do.
> So if you don't like LFS' way that looks like Debian's, then feel free
> to follow Redhat's style instead (actually the LFS boot setup is a mix
> between Debian and Redhat - I tried to take the best from both
Well, as I mentioned in my previous mail, I automatically edited the
relevant code out, so it didn't affect me personally. I brought this
subject up because IMO the LFS setup violates the Principle of Least
Surprise for most people.
Also, Chapter 7's "How does the booting process with these scripts work?"
section makes the K-stop/S-start correlation, but doesn't mention the
exception for runlevels 0 and 6. The only place it's stated is in the rc
script, which no one is likely to revisit ever again after the initial
So unless one were paying close attention when building the server,
noticing and remembering that 0/6 scripts /always/ get "stop"...SURPRISE!
If this is the way rc will work for the foreseeable future, at least
consider making a note of this exception in the abovementioned section for
3.0-pre4 or something.
> I do plan on changing the book setup at some point so we're not going
> to touch the setup now just to re-do it again in the near future.
Fair enough. We both have to do what we feel is right, which is the only
reason we're having this exchange. "Speak now, or forever hold your
piss", or words to that effect.
And now I'll shut myself down (being 12 hours away from you), perhaps to
continue this later. Good night/afternoon/whatever.
Adrian Ho lexfiend at usa.net
More information about the lfs-book