IT系メモ

興味のあったことや、勉強したことなどをメモしていきます。

レポート

runlevelコマンドの出力についてちょっとわからんことが。runlevelのmanには

RRuunnlleevveell reads the system _u_t_m_p file (typically _/_v_a_r_/_r_u_n_/_u_t_m_p) to locate
the runlevel record, and then prints the previous and current system
runlevel on its standard output, separated by a single space. If there
is no previous system runlevel, the letter NN will be printed instead.

If no _u_t_m_p file exists, or if no runlevel record can be found, rruunnlleevveell
prints the word uunnkknnoowwnn and exits with an error.

RRuunnlleevveell can be used in _r_c scripts as a substitute for the System-V wwhhoo
--rr command. However, in newer versions of iinniitt(8) this information is
also available in the environment variables RRUUNNLLEEVVEELL and PPRREEVVLLEEVVEELL.

ってあって、書いてある通り、前と現在のシステムのランレベルを示してるのはよくって、前のシステムのランレベルがないとNが表示されるのもいいんだけど、例えばtelinit 1によってランレベル1にしてrunlevelコマンドで確認すると

1 S

と表示される。

ここ(http://linuxfromscratch.org/pipermail/lfs-dev/2000-July/005476.html)には

On Tue, 25 Jul 2000, Gerard Beekmans said this:
> > Among other things, this does `exec init -t1 S` . I am only curious
> > if this is "odd" or a "standard" behaviour? I figure that `init 1`
> > and `init S` should behave differently. Right? Wrong? Comments
> > invited! ;-)
>
> I'm not sure about it either. I just know that I use runlevel S when the
> system is booted (read when the si::sysinit:/etc/init.d/rcS line is read
> by init and executed so it runs scripts in /etc/rcS.d) and runlevel 1
> can be your default run level (single user mode - no networking, no
> multi-user. Single user mode, as it's implemented often, starts the
> sulogin program so you can login as user root and repair. Then you
> change to runlevel 2 for multi-user/no network or level 3 for
> multi-user/full network).
>
> Which reminds me, the single user mode isn't implemented in LFS yet.

Okay, after reading some of the responses spawned by my query,
referring to init and inittab man pages, etc...

I'm going to work on runlevel 1 this weekend (or single or S,
whatever we want to call it). After looking at the various
init-related man pages, which refer to one another, by the way. The
language in those pages can be a bit misleading in the way they were
written. It uses a lot of synonymous language (seems like runlevel 1,
s, S are all synonyms) . Don't quote me on that.

But it does say "runlevel 1 is used to get the system down into
single user mode."

I don't mean anything other than these sorts of things vary in their
interpretation. Like you said in another message...

で、次のコメントに

You should also be able to enter single user mode on boot by hitting tab key
at lilo prompt and typing a kernel label followed by 1, i.e.: lfskernel 1or
type "single" a the lilo prompt to repair if that has been added as a option
to lilo. See recnt article on LinuxWorld for more detail:
http://linuxworld.com/linuxworld/lw-2000-07/f_lw-07-geek_2.html
Just adding kill links to everything which is started in higher runlevels
should work for backing down to a runlevel 1 state, plus start links for
whatever you want to keep running, but I don't know for sure about how to
set it up for booting. This is what I have from
Caldera's innitab:

# What to do in single-user mode.
~1:S:wait:/etc/rc.d/rc 1 #What do the tildes do
here? Set to /root? (my comment, not Caldera)
~~:S:wait:/sbin/sulogin

I have heard some pro's and cons about having to login in level 1, but if
you've been cracked and passwords wiped, you can still get in with
"init=/bin/sh" at the lilo prompt. (See article above)

ってあるんだけど、やっぱりよくわからん。