Saturday, August 21, 2010

Logging boot output

Ever seen an unnerving [ !! ] scroll by during boot, hidden among 50 lines, way too fast to be able to actually read the problem? Then X then starts, it clears the buffer in the TTY, not allowing you to scroll up to read it when you do a VT-switch back to TTY1.

While 'dmesg' (or reading /var/log/dmesg or /var/log/messages) shows you the boot output from the kernel and other parts of the system, it usually doesn't show the issues from specific boot processes that show up in the list with [ ok ] or [ !! ]. Well, we can actually enable the logging of the console output from the boot process by a few simple steps.

This applies to a Gentoo system, and I'm not sure which other distributions it works for.

#1. First enable RC logging by editing '/etc/rc.conf'. Uncomment the following line (marked by '>'):
# rc_logger launches a logging daemon to log the entire rc process to
# /var/log/rc.log
# NOTE: Linux systems require the devfs service to be started before
# logging can take place and as such cannot log the sysinit runlevel.> rc_logger="YES"

Then we also need to install the showconsole daemon which does the actual logging.

> eix-sync showconsole
[I] app-admin/showconsole
     Available versions:  1.07 1.08
     Installed versions:  1.08(22.23.03 2010-08-21)
     Description:         small daemon for logging console output during boot
Just run 'emerge showconsole' and reboot, after that all the messages scrolling past the screen as you boot will be stored in /var/log/rc.log.