2

I'm trying to diagnose some boot problems I am having with a custom linux kernel that I have configured and built. I've been digging through some of the source code for klogd, and apparently, if debugging is enabled (via the -d option), it should be printing some error messages to stderr. I know that on a terminal, stderr usually goes to the same place as stdout; however, in this case, there is some issue with the screen/console configuration and so nothing is printing to the screen at all during boot (although kernel boot messages are being printed to /var/log/kern.log).

However, the klogd stderr messages that I'm expecting don't seem to be getting printed to that log file.

So, my question is: where are prints to stderr supposed to be going to during the SysVinit boot sequence? Is it possible to redirect all of these to a file? If so, what is the best way to do that in the init scripts?

Thanks in advance!

Edit: Contents of /etc/syslog.conf:

# Begin /etc/syslog.conf

auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *

# End /etc/syslog.conf
  • It's system dependent whether boot messages (stdout and stderr) are printed to a serial port, for example. For the log files, I think you should include your /etc/rsyslog.conf. – Philippos Nov 2 '17 at 8:48
  • @Philippos: Just added the contents of my /etc/syslog.conf (this is a Linux From Scratch installation, so it's unmodified from what is recommended there). However, my understanding was that this file governs what happens to 'system log messages' specifically, not necessarily any print to stderr. I could easily be mistaken though. – Time4Tea Nov 2 '17 at 11:02
1

According to No. 1 of this question and this answer, boot process stderr and stdout are not captured anywhere by default, unless explicitly redirected to syslog. However, one can use a tool such as bootlogd, a daemon started by sysvinit, to capture these messages.

Such a service would need to start before klogd in your case, which, depending on the distribution, can be achieved with the use of LSB init headers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.