[Solved] Why printk doesn’t print message in kernel log(dmesg)

The kernel log ring buffer behaves as if it were line-buffered, as it can be seen in the implementation:

  • in vprintk_emit you can see how it marks a buffer to be flushed/buffered based on the existence of a trailing newline

  • in log_output you can see the actual code which takes care of flushing or buffering the message

As it is evident, your messages do not contain trailing newlines. Had you deleted the trailing space, you would see the messages in the kernel log after they had been flushed in the printk call(s).

Read more here: Source link