Runlevels and poweroff

Peter B. Steiger WYpbs_003 at
Sat Sep 25 10:31:57 PDT 2004

I'm having trouble getting the poweroff (or shutdown -h now) command to
actually power off, so I'm tweaking the scripts in my rc0.d directory to
make sure everything happens in the right order.

Since my LFS installation is from February 2003, I figured it's time to
see if improvements have been made in the bootscripts package, so I
downloaded 2.2.3 to see what has changed.

Among other differences, version 1.11 uses all K scripts in rc0.d and
version 2.2.3 uses a couple of K scripts and the rest S scripts.  At the
time I didn't know any better, so I just copied them as is into my
/etc/rc.d directory.

Maybe I'm misunderstanding how the shutdown process works, but it seems to
me K scripts (e.g., K90localnet) would never occur.  Say I boot up in
runlevel 3.  The way the rc.d/init.d/rc script works, it seems like the K
scripts only run on $PREVLEVEL.  So if I'm shutting down from runlevel 3,
I would enter runlevel 0, and rc would execute rc3.d/K* before executing
rc0.d/S*, correct?  With that in mind, I don't see how K scripts would
ever be run from rc0.d because at shutdown you would never have a

If there's another step that takes place causing PREVLEVEL to also equal
0, could someone give me a couple of whacks with the clue stick?

More information about the lfs-support mailing list