Set the console kernel logging level

Bruce Dubbs bruce.dubbs at gmail.com
Mon Apr 16 17:47:48 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.
> 
> 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.
> 
> Thoughts? Any of the naming semantics are surely up for argument, but
> the script makes things very nice on my system. Although it's cool to
> see all my USB nodes enumerated a couple times, it's nice to quiet
> things down when you know they're working.

Seems like a reasonable thing to do, but there should be an optional 2nd
parameter that is a new loglevel so you could do something like:

/etc/rc.d/init.d/bootmessage start 4

To set it to level 4.  Of course it is probably easier to just do `dmesg
-n 4`.  :)

Personally, I don't mind the interleaving of messages.  For me, the only
thing that comes up late is messages from the wifi driver.  I wouldn't
want those off so I could see if a script that uses the card tries to
start too early.

  -- Bruce



More information about the lfs-dev mailing list