How to enable boot-time logging (/var/log/boot.log) in Red Hat Enterprise Linux 5?
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:
-
Download the attached patch file rc-bootlog.txt to a RHEL5 system (use
wget
from the system in question or right-click & save as) -
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 theboot.log
)
Run the following to prevent local7 logs from going toboot.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.
17 Comments
As an administrator who has RedHat 5 for multiple production servers - I'm shocked that the /var/log/boot.log file is not working and this is being ignored. "Will be fixed in Version 6" is bush league. Hello - this is Red Hat Enterprise LINUX! What part of Enterprise don't you understand? The server is not in my bedroom under my desk. It's in a work envoronment running multiple oracle databases for a DoD agency. I'm disappointed.
I agree. Boot.log is convenient.
Most of the HW does not provide good consoles, Like HP ILO, scroll up fast. & you need to know how the inint scripts behave. boot.log is very usefull.
Very disappointed in this.
Has anyone tried the workaround?
@Tejas: The article was just rewritten with a (IMHO) better work-around. The new solution will work with any version of RHEL5 and relies on modifying the
rc.d/rc
script to use bash fd-redirection, as opposed to modifyingrc.d/init.d/functions
to use the deprecated initlog feature.The rc.d/rc fix does not work for me, "Red Hat Enterprise Linux Server release 5.10 (Tikanga)"
The server does not reboot, had to use magic SysRq to force rebooting.
The last lines in /var/log/boot.log during the shutdown:
These lines are printed on the console but not sent to /var/log/boot.log
I reverted back to the old rc script.
@Kolja Von Sawilski:
When I wrote the solution, I oddly didn't anticipate the consequences for systems where /var is separate from the rootfs. I'll get back to you.
Any news on this point? We are considering this solution and we are in this scenario.
Yes Paul I've updated the solution. (See below comment.)
@ Kolja Von Sawilski: I've rewritten the code and provided it (this time) as a patch file with instructions to use a patch command. I've thoroughly tested it but please comment back with your results if you try it.
Hi,
It is working now! Thanks for the update.
Note using copy paste the content of the patch file I had to use the '--ignore-whitespace' to your patch command.
Anyway, it looks good now.
I'm glad! You're most welcome.
Ah! Fixed with a new patch file. Thanks for the catch!
incredible
https://bugzilla.redhat.com/show_bug.cgi?id=151238 ?
@Riccardo Reggiani: I'm not sure what you're asking about that Fedora BZ...?
I am getting bootlog messages now for runlevels 5 and 6 - thanks.... But, what about logging of the runlevels from 0 to 4?