Set the console kernel logging level
dbn.lists at gmail.com
Mon Apr 16 20:53:56 PDT 2007
On 4/16/07, DJ Lucas <dj at linuxfromscratch.org> wrote:
> Dan Nicholson wrote:
> > One of the things that can be irritating while booting is having all
> > the kernel messages mixing in with the messages from the bootscripts.
> > Attached is a script that will set the console log level with dmesg to
> > a configurable level.
> Always has bugged me too...please fix it! :-)
Yes sir! I've got some other fixes that are distracting me from bug fixing.
> > The script reads the variable LOGLEVEL from
> > /etc/sysconfig/bootmessage. The default is 7, which seems to be what
> > the kernel sets on my system. There's a sanity check to see if this
> > value is between 1 and 8. I just determined those by trial and error.
> > Someone more knowledgeable about the kernel ring buffer might know
> > more. There's also a status target to print the current level.
> > I have the script installed as rcsysinit.d/S02bootmessage so it runs
> > right after /proc gets mounted in mountkernfs. Basically the same
> > thing happens in S05modules right now except that it restores the
> > value, so part of that script could be removed.
> This is where the sysctl script should be run. /proc and /sys should be
> available by that time. It was moved a long time ago, memory is fuzzy
> but I think it was due to a timing issue. Anyway, it is designed
> explicitly for this purpose. Instead of adding scripts, how about this
> (I think it's right):
> echo kernel.printk 4 >> /etc/sysctl.conf &&
> mv /etc/rc.d/rc.sysinit/S90sysctl /etc/rc.d/rc.sysinit/S00sysctl
> Of course you can make the rest of the modifications if you like,
> (kernel.printk 4 7 x x). I don't recall sane values for the rest of
> them or what they are for. Also, please double check the syntax above
> for the sysctl.conf file, I don't have a linux box handy ATM where I can
> be exactly certain.
I did not know that. The only problem with the sysctl script is that I
don't think most people know how to use sysctl. This is a viable
solution under one condition: sysctl needs to be documented in the
book. The convenience of a wrapper script is that you can abstract the
I don't really know the kernel-userspace interface enough to know when
it's a safe time to start calling sysctl, but my feeling is that you
can do it very early. So, we should consider moving that script up
regardless of the outcome of this decision.
More information about the lfs-dev