How to enable boot-time logging (/var/log/boot.log) in Red Hat Enterprise Linux 5?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5.3 and later

Issue

  • Why is /var/log/boot.log empty in Red Hat Enterprise Linux 5?
  • It seems that since rhel 5.3, the /var/log/boot.log is empty. Is there a way to check boot time logs?
  • How can we check on our headless server to see what happened with a service at boot time? We're not sure if it failed to start or failed later.

Resolution

  • In Red Hat Enterprise Linux 5, the /var/log/boot.log file was only populated (with service-loading success/failure info) in version 5.0, 5.1, & 5.2

  • For earlier parts of the boot process (i.e., kernel logging), /var/log/dmesg has always been available (and those logs should be duplicated in /var/log/messages)
     


Work-Around for Missing boot.log in RHEL 5.3+

The following information is provided by Red Hat Global Support Services "as-is" for the benefit of the user
Red Hat GSS makes no guarantees as to the fitness of the configuration changes suggested herein

One way to enable population of /var/log/boot.log in any version of RHEL5 is to modify the service-loading script /etc/rc.d/rc
Steps:

  1. Download the attached patch file rc-bootlog.txt to a RHEL5 system (use wget from the system in question or right-click & save as)

  2. While in the directory containing the txt patch file, run the following command:

    patch -bp0 <rc-bootlog.txt
    
  • Notes:

    • The above patch file and patch command will create /etc/rc.d/rc.orig (a backup) before performing any modifications

    • The end result will be that on every change of runlevel (including boot and shutdown), service success/failure output will be appended to boot.log, in addition to going to the physical console

    • It would also be prudent to comment/delete the local7.* /var/log/boot.log line from the standard syslog configuration, as it is no longer being utilized (if this is not done, stray log entries from applications that utilize the local7 facility could end up in the boot.log)
      Run the following to prevent local7 logs from going to boot.log

      sed -i 's/^local7.*boot\.log.*/#&/' /etc/{r,}syslog.conf
      for s in /etc/init.d/{r,}syslog*; do $s condrestart; done
      

Root Cause

  • The initlog functionality was officially deprecated in RHEL 5.3 and there is currently no official replacement to cleanly provide the traditional /var/log/boot.log
    Per the RHEL 5.3 Release Notes:

    Boot-time logging to /var/log/boot.log is not available in Red Hat Enterprise Linux 5.3.

  • This issue is not targeted to be fixed in Red Hat Enterprise Linux 5
    Note however that Red Hat Enterprise Linux 6 is not affected by this issue
    (In RHEL6, plymouth and rsyslog take care of populating /var/log/boot.log)

  • For further details, see:
    Bug 223446 - Boot time messages from init scripts not being logged to /var/log/boot.log

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments