Installing Ubuntu Kernel Debugging Symbols

Debugging symbols contain source code level information such as function names, function calling conventions, and source line numbers to instructions mapping. This information is very useful when debugging or profiling the kernel. In this article, I will show how to get debugging symbols on Ubuntu with any kernel.

There are two ways to get the debugging symbols. Either build the source code of the kernel with debugging symbols or install the symbols separately. The first approach is followed when you want to modify the source code and work on your own kernel. Otherwise, you can follow the simpler second approach. Even if you need the source code (to step through it during debugging, for example), you can still follow the second approach by downloading the source code and point the tool you’re using to the containing directory. You don’t have to build it. I will discuss the second approach here.

Step 1: GPG key import

Make sure that you have the GPG key of your system. For Ubuntu 16.04 and higher:

sudo apt-key adv --keyserver --recv-keys C8CAB6595FDFF622

For older distributions:

sudo apt-key adv --keyserver --recv-keys ECDCAD72428D7C01

Step 2: Add repository config

codename=$(lsb_release -c | awk  '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb ${codename}      main restricted universe multiverse
deb ${codename}-security main restricted universe multiverse
deb ${codename}-updates  main restricted universe multiverse
deb ${codename}-proposed main restricted universe multiverse

Step 3: Update packages

sudo apt-get update

Step 4: Download and install the debugging symbols

sudo apt-get install linux-image-$(uname -r)-dbgsym

Step 5: Verify that the symbols have been successfully downloaded

The file that contains debugging information is called vmlinux-XXX-debug where  XXX is the kernel version. The file is stored under /usr/lib/debug/boot.


One thought on “Installing Ubuntu Kernel Debugging Symbols

  1. Pingback: The Art of Profiling Using Intel VTune Amplifier, Part 1 | Micromysteries

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s