Skip to contentSkip to conversation

syslog messages during boot not recorded?

Buildroot Francesco Montorsi 2 participants 7 messages Apr 8, 2013 – Apr 11, 2013

lore
Share & tools
lore
#0 lore raw

Hi all,
I'm using buildroot v10.11 on an embedded system running Linux kernel 2.6.32.2.

I installed some daemons wrote by me which are started at boot time by some /etc/init.d scripts of mine. These daemons use many syslog() to provide verbose debugging messages... however, for some reason, when I boot the system and cat /var/log/messages, I do not see any message.
If I start manually the daemons, the messages are correctly logged to /var/log/messages...

I think that this problem maybe because syslogd is startd AFTER all /etc/init.d scripts have been processed.. is that right?

I tried to comment the lines:

null::respawn:/sbin/syslogd -n -m 0
null::respawn:/sbin/klogd -n

contained in /etc/inittab and then to add the S01logging script found in this patch:
http://lists.busybox.net/pipermail/buildroot/2011-July/043828.html

but I obtained the same results... (of course my etc scripts start with S90, S91, etc, so they should run AFTER S01logging...)

Thanks for any hint!
Francesco

#1 lore raw
Quoted 9 lines · Francesco Montorsi

I installed some daemons wrote by me which are started at boot time by some /etc/init.d scripts of mine. These daemons use many syslog() to provide verbose debugging messages... however, for some reason, when I boot the system and cat /var/log/messages, I do not see any message.
If I start manually the daemons, the messages are correctly logged to /var/log/messages...

I think that this problem maybe because syslogd is startd AFTER all /etc/init.d scripts have been processed.. is that right?

Hi.
Or maybe your busybox is configured to use the circular buffer (in RAM) for logs (CONFIG_FEATURE_IPC_SYSLOG)... and you should just read your logs with "logread"...
Regards.

author
#2 lore raw

Hi,

2013/4/8 Gustavo Zacarias <[email protected]>:

Quoted 3 lines

Or maybe your busybox is configured to use the circular buffer (in RAM) for logs (CONFIG_FEATURE_IPC_SYSLOG)... and you should just read your logs with "logread"...

well, my buildroot is not the latest version... I'm using version 10.11 and I cannot see anything similar to IPC_SYSLOG in its .config... maybe this is a feature of newer buildroots?

Thanks!
FM

#3 lore raw
Quoted 6 lines · Francesco

well, my buildroot is not the latest version... I'm using version 10.11 and I cannot see anything similar to IPC_SYSLOG in its .config... maybe this is a feature of newer buildroots?

Thanks!
FM

It's a feature of BUSYBOX, not buildroot, meant for syslogd to work in scenarios where your /var/log directory isn't writable for example. Which begs the question, is it writable?
Regards.

author
#4 lore raw

2013/4/8 Gustavo Zacarias <[email protected]>:

Quoted 3 lines

It's a feature of BUSYBOX, not buildroot, meant for syslogd to work in scenarios where your /var/log directory isn't writable for example. Which begs the question, is it writable?

good point... my /var/log is a symbolic link to /tmp and "ls -l" shows that its permissions (after system boot) are "drwxrwxrwt". I think the problem may be due to /tmp being mounted AFTER/AT THE END of the system boot... in fact, /tmp is a tmpfs... the relevant line in /etc/fstab is:

tmpfs /tmp tmpfs defaults 0 0

now my question is: how do I ensure that /tmp is mounted before /etc/init.d scripts are run?

Thanks a lot!
Francesco

author
#5 lore raw

In any case, something I do not understand is the reason why /var/log/messages contains a lot of messages marked as "kernel: " and referring to the boot of the system (hardware configuration, CPU features, etc etc etc)... these messages are probably generated much earlier than /etc/init.d scripts are run!

Thanks for any hint,
Francesco

2013/4/9 Francesco <[email protected]>:

Quoted 17 lines

2013/4/8 Gustavo Zacarias <[email protected]>:

Quoted 3 lines

It's a feature of BUSYBOX, not buildroot, meant for syslogd to work in scenarios where your /var/log directory isn't writable for example. Which begs the question, is it writable?

good point... my /var/log is a symbolic link to /tmp and "ls -l" shows that its permissions (after system boot) are "drwxrwxrwt". I think the problem may be due to /tmp being mounted AFTER/AT THE END of the system boot... in fact, /tmp is a tmpfs... the relevant line in /etc/fstab is:

tmpfs /tmp tmpfs defaults 0 0

now my question is: how do I ensure that /tmp is mounted before /etc/init.d scripts are run?

Thanks a lot!
Francesco

#6 lore raw

A few more results from my investigations: the absence of logged messages does not depend from the values of the facility/level options passed to openlog() or syslog() (apparently).
Moreover, a process started at boot time and doing periodic syslog() calls, will generate output in /var/log/messages at some point, but all its initial syslog() messages are lost.

At this point, I will write a syslog() wrapper to log to a file the messages I need, rather than rely on a working syslog() during boot :(

Francesco