Set the console kernel logging level

DJ Lucas dj at linuxfromscratch.org
Mon Apr 16 20:12:18 PDT 2007


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!  :-)
> 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.

-- DJ Lucas




More information about the lfs-dev mailing list