How to increase kernel log buffer?

Hello

When I power-on Omnia it boots about one minute. Then I can connect via ssh and execute dmesg.
But after one minute first 20 seconds of kernel log are unavailable because of buffer size (they were overwritten).
I had to dump dmesg to temporary file in /etc/preinit to play with msata drive, but it is not a solution.

Is there any config option to increase size of this buffer without kernel rebuild?

2 Likes

in “big linux” there is kernel parameter changing this, but does anybody know how to change kernel boot parameters in omnia/openwrt ?

2 Likes

You can use uboot (trough serial console is, I think, possible to add temporally any boot parameter) or recompile Turris OS. None of which is good option. But kernel log is also logged by syslog. So you should be able to found whole kernel log in /var/log/messages. You can get it with some grep command, such as grep "kernel\[\]:" /var/log/messages.

For even better option, see syslog-ng documentation and configure it so that kernel log is logged also to separate file.

Any chance of supporting uboot-envtools on Omnia? That would make it way more convenient…

As for kernel log, the problem is that you loose part of it before syslog starts, so there is really no chance to recover this.

There are other cases where changing kernel command line might be useful, I was asking about it some time ago as well:

1 Like

Almost
Kernel entries in /var/log/messages starts with syslog.
Which means around 14 seconds from power-on.

notice syslog-ng[2477]: syslog-ng starting up; version='3.0.9'
info kernel[]: [   14.158130] tun: Universal TUN/TAP device driver, 1.6

All log entries created earlier are lost.
And when I run dmesg just after boot process completes, kernel logs start at abour 28 sec.
The part I was looking for was around 7 seconds from power-on, so it was unavailable without that hack in preinit script…

I see. It’s probably because we are using just /dev/log as source for syslog, we should probably at syslog-ng start also source /dev/kmsg. I will add it to my todo list, but I can’t promise that I will look in to it any time soon. So yes solution with syslog doesn’t work unless you do some syslog-ng configuration hacking.

Same for uboot-envtools. I added it to my todo list and will present it to colleague handling uboot. But can’t promise anything for now.

1 Like

This is from the default /etc/syslog-ng.conf file:

source kernel {
        file("/proc/kmsg" program_override("kernel"));
};

so /proc/kmsg is already been read by syslog NG or do you mean replacing /proc/kmsg with /dev/kmsg?

I read a little bit of kmsg. /dev/kmsg is newer and more advanced interface for kernel ring buffer compared to /proc/kmsg so I tried to change syslog-ng to read /dev/kmsg but that didn’t work. It seems that syslog-ng on Omnia is so old that it doesn’t support /dev/kmsg.