Linux – Ubuntu – why would /var/log/dmesg stop updating after boot? does not show panic/cpu_hung errors which the console shows

linuxloggingUbuntu

So I have an Ubuntu 10.04 install VM on a host.
Latest 2.6.38-15-server kernel .
/var/log/dmesg displays only the bootup but will stop recording after that.
It will not show the trace/cpu_hung errors I am trying to troubleshoot.
/var/log/dmesg.0 , dmesg.1 nothing – I did a string search for the text that displays on the console during the crash and NOTHING gets logged anywhere in /var/log/* .

I have to call into the provider and ask them to take a screenshot of the console since nothing shows in dmesg.

Why would /var/log/dmesg not record kernel panics, or such?

Best Answer

Whether you fix kernel logging past boot time or not will not help with kernel panic messages. When your kernel panics, it stops scheduling, so your logging daemon won't ever get to write down the kernel messages. If you want to grab those, you can look into kdump to get complete kernel core dumps and/or the netconsole kernel module to send the kernel messages over UDP to a remote syslog server.

As to getting kernel messages into /var/log/dmesg past boot time but outside of serious kernel crashes, try to have something like this in /etc/syslog.conf (or /etc/rsyslog.conf if using rsyslog):

kern.* /var/log/dmesg

For rsyslog, the file must also contain:

$ModLoad imklog.so

Let me know if you're using syslog-ng, it'd be a bit trickier to cover.