LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Clean up your LFS boot-time console messages (http://www.linuxquestions.org/questions/linux-from-scratch-13/clean-up-your-lfs-boot-time-console-messages-4175427926/)

stoat 09-18-2012 11:33 PM

Clean up your LFS boot-time console messages
 
2 Attachment(s)
While some distros hide the kernel and init script messages during booting behind graphics to mesmerize me for those few seconds, I never stopped preferring the old fashioned kernel and init script message spew at boot time.

Did you notice in the transition from LFS v7.0 to v7.1 that what we see on the console screen changed a little? Now, after printing the init script's message to the left and the [ OK ] status to the far right, init-functions backs up the cursor and prints a green asterisk (SUCCESS_PREFIX) to the left of the message text. There are other colored asterisk PREFIX patterns for warnings and failures. I like it.

Anyway, here's what I'm driving at... Somebody (Beekmans, Lucas, Dubbs) went to the trouble to code those script variables in /lib/lsb/init-functions to pretty-up the console screen, but then the kernel comes along and scatters routine informational messages all throughout the pretty init script stuff. And it's mostly useless stuff, too. I mean, who needs to know that the ethernet interface is down before it goes up? I only need to know that it went up, and the pretty network init script message does that. Or, who needs to be reminded of the swap device name by the kernel at the expense of ruining the swap init script's simple message that the swap was activated? The result of this mix of kernel and init script messaging on the console is ugly IMO.
Attachment 10723
I tried various script hacks here and there to clean up this mess. But here is what I think works best and is by far the easiest to do... change the kernel's printk console_loglevel parameter in /etc/sysctl.conf. The current default value for console_loglevel is 7 which causes the kernel to emit to the console all messaging except debugging messages. Changing that number to 4 eliminates routine informational, normal, and warning messages. You still are informed that everything that needed to be done got done and succeeded. But the visual layout of the information in the console looks much better without being chopped to pieces by less-than-useful kernel jabber.

Here is how to do it. Add these lines to /etc/sysctl.conf...
Code:

# Uncomment the following to stop low-level messages on console
kernel.printk = 4 4 1 7

That first number is console_loglevel. The setting of 4 means that only messages about errors and critical conditions will be sent to the console. Now, when you boot and shutdown, the init script messaging should be much cleaner and you will be deprived of nothing that you really needed to see (IMO).
Attachment 10724
To see what your current kernel.printk parameters are now, simply cat /proc/sys/kernel/printk. For more about the kinds of kernel messages allowed by the numbered levels and what the other three numbers mean, see the references below.



Some references:
http://www.mjmwired.net/kernel/Docum...ctl/kernel.txt
http://www.linuxjournal.com/article/2365
http://linux.die.net/man/2/syslog



P.S.: This is not new stuff and not the first LQ thread about it. But I didn't find any in the LFS sub-forum or any with very much explanation about the matter. That's what I wanted to add to the record. Mostly.

re_nelson 09-28-2012 12:54 PM

Quote:

Originally Posted by stoat (Post 4783838)
Anyway, here's what I'm driving at... Somebody (Beekmans, Lucas, Dubbs) went to the trouble to code those script variables in /lib/lsb/init-functions to pretty-up the console screen, but then the kernel comes along and scatters routine informational messages all throughout the pretty init script stuff. And it's mostly useless stuff, too. I mean, who needs to know that the ethernet interface is down before it goes up? I only need to know that it went up, and the pretty network init script message does that. Or, who needs to be reminded of the swap device name by the kernel at the expense of ruining the swap init script's simple message that the swap was activated? The result of this mix of kernel and init script messaging on the console is ugly IMO.

Thanks for this very useful information. The extraneous messages interspersed with with the actual boot information serves to obscure what's essential. The effort of the LFS team to improve the boot-time look and functionality is appreciated and your tip enhances their work.


All times are GMT -5. The time now is 12:24 AM.