I have a custom initramfs whose logging output I wish to redirect to /dev/kmsg. The Kernel I am using is 5.10.52

However, I realized that I cannot write more than 992 bytes to /dev/kmsg at once. Is this size limit configurable via one of the Kernel Configs? Also why is the limit 992 specifically? What I observed is that this limit is 32 bytes shorter than 1024.

1 Answer 1


The limit is determined by LOG_LINE_MAX in kernel/printk/printk.c.

In 5.10.52, that’s defined as 1024 - PREFIX_MAX; the latter is set aside for the log prefix, which is 32 bytes by default, 48 bytes if CONFIG_PRINTK_CALLER is enabled. To increase the limit, replace 1024 with whatever value you deem appropriate.

Since 5.13, LOG_LINE_MAX is based on CONSOLE_LOG_MAX, so you’d change that instead.

I don’t know what the knock-on effects of increasing the limit would be, if any.

  • Got it, Thanks! Although I wish this was given as a Kernel Config whose value could be changed via menuconfig. Thanks for the links. Since I'm using 5.10.52, the variables are different - LOG_LINE_MAX for 5.10.52.
    – Harsh
    Apr 8, 2022 at 6:24
  • Oops, I should have written this for 5.10.52; I’ve fixed that. Apr 8, 2022 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .