Kernel Log to Persistent Storage

Hi,

I have been struggling getting a new device working, and because it's a sealed unit (with battery), I really don't have any serial port access - so when it hangs on boot, I'm flying blind ... :frowning:. But I don't think this issue is necessarily limited to this device - rather any device where a serial port is not accessible (or just not practical).

I tried to get netconsole working, but no luck. Has anyone been able to get the kernel log (console) output to some sort of persistent storage, like USB, microSD, or whatever? I know there can be flash wearout issues ... but for debugging, that's a don't care ... :smile: Thoughts?

Thanks!

Catch-22

To log to a persistent file system you need it mounted with device and file-system drivers. It’s the kernel that does that. And if you’re trying to figure out why the kernel isn’t starting up properly...

You might be able to hack (early) printk to write to a raw MTD partition, but I really think that connecting serial or buying a supported device (or at least one with easier serial access) would be a better plan.

This is where Android's last_kmsg will shine...
Anyway, if the system boots it can send the system logs to another server that will keep it (if configured to do so), they include the kernel logs.
Else, attaching the serial console and using the L flag to screen should work.

Very much agree with both of you - thanks! I do agree / know this is catch-22 ... but I haven't found another device that does quite what this one does, so hard to "replace" it, and to get to the serial port I have to destroy it. So that's not really desired ... LOL.

Let me look into last_kmsg. Does that exist on OpenWrt also?

Thanks again.