Why does my printk messages are updated in the log file lately?

kernel, linux-device-driver, linux-kernel

Solution

This happens because you have forgot a newline at the end of your log message. When the kernel outputs a partial message (by passing a string to `printk()` that does not end with a newline), the logging system will buffer the text until the rest of the message arrives. See also — `printk()` problems.

Problem

I have written a simple module as follows: ``` #include<linux/module.h> #include<linux/kernel.h> static int __init own_init(void) { printk(KERN_INFO "Hi"); return 0; } static int __exit own_exit(void) { printk(KERN_INFO "bye"); } module_init(own_init); module_exit(own_exit); MODULE_LICENSE("GPL"); ``` After installing this module, i am expecting Hi, but not displayed. But while am removing the module, Hi is displayed. When i am again inserting, Bye is displayed. So there is a lag. Why is that?

Original source