Oops! Debugging Kernel Panics

debugging kernel panics

A look into what causes kernel panics and some utilities to help gain
more information.

Working in a Linux environment, how often have you seen a kernel panic?
When it happens, your system is left in a crippled state until
you reboot it completely. And, even after you get your system back into a
functional state, you're still left with the question: why? You may have no
idea what happened or why it happened. Those questions can be answered
and the following guide will help you root out the cause of some of the conditions
that led to the original crash.

Figure 1. A Typical Kernel Panic

Let's start by looking at a set of utilities known as
kexec and kdump. kexec allows you to boot into
another kernel from an existing (and running) kernel, and
kdump is a
kexec-based crash-dumping mechanism for Linux.

Installing the Required Packages

First and foremost, your kernel should have the following components statically built in to its image:


You can find this in /boot/config-`uname -r`.

Make sure that your operating system is up to date with the latest-and-greatest package versions:

$ sudo apt update && sudo apt upgrade

Install the following packages
(I'm currently using Debian, but the
same should and will apply to Ubuntu):

$ sudo apt install gcc make binutils linux-headers-`uname -r`
 ↪kdump-tools crash `uname -r`-dbg

Note: Package names may vary
across distributions.

During the installation, you will be prompted with questions to enable
kexec to handle reboots (answer whatever you'd like, but I answered
„no“; see Figure 2).

Figure 2.
kexec Configuration Menu

And to enable kdump to run and load at system boot, answer
„yes“ (Figure 3).

Figure 3.
kdump Configuration Menu

Configuring kdump

Open the /etc/default/kdump-tools file, and at the very top,
you should see the following:


Veröffentlicht von Paul Christoph

Mein Name ist Paul Christoph Feichtinger, geboren am 15.5.1991 in Oberndorf bei Salzburg und mittlerweile stolzer Autor von 11 Büchern (7 in Deutsch und 4 in Englisch), 4 Apps (bald kommt Nummer 5) und dieser Webseite. Bei Paul Solutions bekommen alle Bücher und Apps ihre Form. Sieh dich ruhig ein bisschen auf meiner Webseite um, vielleicht gibt es auch für dich noch das ein oder andere zu entdecken. ;-)

Kommentar verfassen

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

%d Bloggern gefällt das: