Artificial intelligent assistant

How do I detect that my system has auto-rebooted after a kernel panic? I'm using Linux in embedded systems, and want to configure the system to automatically reboot after a kernel panic. However, when the system comes back up, it's important for me to detect and log the fact that the kernel panicked (rather than, say, the user toggling the power switch). I could configure a kernel core dump on panic, and check for the dump on restart, but that seems like it could cause trouble if the file system isn't A-OK (plus I've been trying to set up kernel core dumping and have yet to succeed). Any suggestions?

If you run customized kernels for your embedded hw and have some hw register/bit available you may be able to customize the kernel crash code to set a flag in that hw location which you'd check after reboot.

If not AFAIK you're only chance is to configure your kernel core dumping facility. Indeed, it's risky to write to a 'live' filesystem, but you can use a swap partition or a small dedicated partition instead.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 62c4ff3cf54107f8a805acbeb954c2a6