Getting linux kernel debug information after kerne

2020-03-22 06:37发布

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.

5条回答
孤傲高冷的网名
2楼-- · 2020-03-22 07:12

You could try to interact with your hung system by entering magic SysRq key sequences via your keyboard or a serial console.

查看更多
姐就是有狂的资本
3楼-- · 2020-03-22 07:25

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

查看更多
神经病院院长
4楼-- · 2020-03-22 07:26

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.

查看更多
Lonely孤独者°
5楼-- · 2020-03-22 07:35

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..

查看更多
够拽才男人
6楼-- · 2020-03-22 07:37

Recent versions of Linux support crash dumps. When successful, these will include a full dump of memory, including kernel log messages and stack traces.

查看更多
登录 后发表回答