Is there any way to get kernel previous debug information after kernel chrash occurs.
I am trying to develop a Kernel module which basically captures IP packets in ip layer inside kernel network stack & after some modification i have to send the same packet back to the NIC for transmission. During all these processes i m writing debug information with the help of printk(). but if any thing goes wrong & kernel failure occurs so we have to restart the system . So is there any way to get my previous debug info because after rebooting the debug info is not present as i try to get it by dmesg command.
You could try to interact with your hung system by entering magic SysRq key sequences via your keyboard or a serial console.
Kernel log messages can be viewed in
/var/log/dmesg
files even after restart of the system.There will be so many files with dmesg.X, those files are previous kernel logs.
dmesg
is the latest file.difference between dmesg and /var/log/kern.log
Actually, the crash information (dmesg) is present in the location /var/crash/. Here we have the folders for every system crash. Folder names like 127.0.0.1-date-time. vmcore-dmesg.txt are present inside the folders. From these file, we have get the dmesg which are executed before the crash.
Actually /var/log/dmesg file contains the current boot print message log. The /var/log/kern.log file contains your previous boot kernel print message log in ubuntu. In other linux flavours it will contain in the /var/log/messages file in fedora etc..
Recent versions of Linux support crash dumps. When successful, these will include a full dump of memory, including kernel log messages and stack traces.