Mailinglist Archive: opensuse-factory (505 mails)

< Previous Next >
[opensuse-factory] Re: Boot Log
Steven Sroka wrote:
Is there a "boot log" available after each boot up of openSUSE?

I know there are a lot of components/scripts that run during boot time
so a unified log is probably a pipe dream, but is there anything
I got an error message during first boot up of 12.1 M3, but I couldn't
read what was wrong, so I'm trying to find out and then report it.

Steven Sroka
I found this to be helpful in improving readability....

-rwxr-x--- 1 370 Feb 12 2008 boot_cons_log*
more boot_cons_log
#!/bin/bash -ue

if [ $CONSLOG -ot $BOOTMSGS ]; then
if [ -e $CONSLOG ]; then
/usr/bin/sed -r 's/(<[a-z]+>([^]]+]){2})|(^<[0-9]>)//' <$BOOTMSGS &> $CONSLOG
echo "Bootlog stored in $CONSLOG"
echo "Bootlog in $CONSLOG"

Also, wondering where I could put a patch like this so it wouldn't
get overwritten by system updates...(or if it would be useful
in mainline in some form...)

the first part is generally good about saving successive boot logs
in a zipfile in /var/log, which built up a ~800K log file over
a year (but I don't boot alot, -- but I could compare diffs
between successive boots going back (as long as I take care not
to have auto-updates on and remember to fix it when I upgrade (which
I often don't until months have passed...and I hve some need for
wanting to look at it...

Could use tar w/append if you wanted to be more unix'y, but
zip lets me test the archive integrity before committing
any new logs, then stores a log -- all in 1 step.

But as far as I know, there are no 'hooks' to call user-safe
files at this point...

The 2nd part of the patch -- should go into mainline/factory
as currently the /bin/dmesg statement only transfers
a max (according to manpage) of 16K of message unless you
tell it too do more.

I added a hard-coded 64k years ago, though now the kernel
default is 128K, and I raised that in my own builds to
512K. Thus I added code taking out my hardcode,
use current kernel defaults if I can't read proc,
else look for the bufsize used in /proc,

Anyway -- 1st just seems useful -- though maybe not for
average end-user...but I've always been interested in
looking down boot logs after installing new kernels to
see what's changed...(not that I do so much these days,
but collecting the data is low cost)...

2nd patch -- might not be necessary if someone's patched
dmesg and didn't update the manpage....but mine will make
an attempt to read the val from proc which won't work on
every system)...

Just some boot-log management/helper stuff I cooked up
years ago (and just updated for the larger kernel defaults
w/detecting actual from /proc if I can...)

I added the 'dmesg -s' code years ago because my boot logs
were losing the initial startup messages....

--- boot.klog.suse114 2010-03-08 07:41:06.000000000 -0800
+++ boot.klog 2011-07-22 02:44:30.605691797 -0700
@@ -24,15 +24,38 @@
case "$1" in
# Read all kernel messages generated until now and put them in one file.
- test -s /var/log/boot.msg && mv -f /var/log/boot.msg /var/log/boot.omsg
- echo Creating /var/log/boot.msg
+ if [ -s /var/log/boot.msg ] ;then
+ ( cd "/var/log";
+ fname="boot-$(date +'%y%m%d.%H%M')"
+ mv -f /var/log/boot.msg "/var/log/$fname"
+ # note zip assumed installed, -- it IS mounted
+ # at this point, as we don't try changing syslog to
+ # 'hard storage' until local fs's are mounted
+ zip -Tmou9y /var/log/ "$fname"
+ )
+ fi
+# test -s /var/log/boot.msg && mv -f /var/log/boot.msg /var/log/boot.omsg
if test -x /sbin/klogd ; then
# klogd syncs out the file
/sbin/klogd -s -o -n -f /var/log/boot.msg
test -s /var/log/boot.msg
rc_status -v1 -r
elif test -x /bin/dmesg ; then
- /bin/dmesg > /var/log/boot.msg
+ declare -i log_shift_dflt=17
+ declare -i log_shift=$log_shift_dfl
+ ( 2>/dev/null
+ [[ clbs="$(gunzip </proc/config.gz | grep "$var" )" ]] && {
+ if [[ -n ${clbs:-""} && $clbs != ${clbs##*=} ]]; then
+ log_shift="${clbs##*=}"
+ fi
+ ((log_shift=log_shift>0?log_shift:logshift_dflt))
+ }
+ )
+ ((log_size=2**log_shift))
+ /bin/dmesg -s$log_size > /var/log/boot.msg
test -s /var/log/boot.msg
rc_status -v1 -r
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-factory+help@xxxxxxxxxxxx

< Previous Next >