Random shutdowns that look like kernel panic But with no sign of kernel panic in the console. The screen just turns black all of a sudden, but the backlight stays on. After up to 10 seconds, it shuts down completely. People I talked to over Apple chat were convinced it was a battery problem, but the battery drains normally, and the problem appears with or without the power cable connected. They had me reset NVRAM and SMC, still no change. I booted into a linux distro from an external drive and used it for more than 12 hours without any interruption. Although not definitive, this strongly suggests that this might be a software problem rather than an hardware problem. If so, how could I pinpoint a problem that doesn't show up in the console? I'm using 10.11.6.

Edit: I should also add that this happens in irregular intervals. It can be as frequent as once in 20 minutes, or as sporadic as every 5 hours.
Go into recovery mode and reinstall MacOS. That sounds like a software issue. Give that a try, if the results are still the same, then you may have a bad drive.