简体   繁体   中英

How can I save or longly see linux kernel BUG message from console?

I'm trying to develop device driver for the linux kernel, but I have a problem with debugging bug message.

I'm working on the desktop (x64) with linux kernel (ubuntu 14.04, and I tried ubuntu server 14.04 too). And, I'm using tty console (ctrl+alt+f1) to take the test, because tty console always print printk message when I enable log level to 7.

My problem is, first I have a bug on my developing device driver code, and second, I can't get the actual cause of bug because I cannot view the all bug message except last-left few bug message.

I tried ssh for debugging, (test PC is ssh server, and ssh client pulls dmesg or ftrace printk message from ssh) but ssh server died earlier than kernel bug message, so that I only could see the bug message from my monitor with tty console.

I also tried to use smaller size console font, but that was just temporal solution.

So, my question is, there are any debugging techniques that fit with this problem?

like, stop printing kernel bug message after first bug message, or redirect tty console to other PC using hardware or something..

Please help me with solution Thanks,

You can redirect various system log streams (including those appearing in dmesg) to any terminal or file by modifying the rsyslog.conf .

Check in you already have a line similar to

kern.* /some/file

/some/file should contain the messages send to dmesg . If no such line exists, create one. If that doesn't work for some reason, replace kern.* with *.* and try that way.

You could also push the contents of dmesg to a file with a command like so dmesg > /var/log/dmesg which could be done regularly by Cron.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM