Recovering a Ubuntu-based System from Kernel Panic after an Upgrade

November 03, 2021 — ~mugman

The Beginning

While I was away from home, my PC rebooted after a manually-initiated upgrade. I came back, and it had kernel-panicked. I scanned the error and noticed something about a config file somewhere, and I kept that in mind. I went to my laptop and downloaded a Ubuntu ISO and burned it onto a spare flash drive, and booted my PC off of it to debug.

The Fix

First, I ran fsck and other disk-recovery tools to make sure nothing imporant was harmed, and after about 30 minutes, the scans reported that all was okay. Sinxe that wasn't the problem, I went to the boot directory to inspect and check the kernel. I noticed that there were some extra files left over from an old kernel version, and I remembered the config error, so I decided to experiment. I moved the old kernel's files into another directory to see what would happen.

The End

I rebooted my PC from the main hard drive and, to my surprise, it fully booted. Everything was fine and okay.

Inspection

From what I see about the kernel error and what I did to fix the system, my theory is that the boot process was reading the configs, but once it hit the config of the uninstalled kernel, it failed and exited because it couldn't find the kernel file. Once I deleted the old kernel's config files, the system did not look for it, and did not kernel panic.

tags: ubuntu, kernel, kernel-panic, linux