Your submission was sent successfully! Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

Debug symbol packages

Note:
This documentation has moved to a new home! Please update your bookmarks to the new URL for the up-to-date version of this page.

If you want to debug a crash – whether in a project you are developing yourself or from a third-party package – or if you frequently need the debug symbols for specific libraries, it might be helpful to install them permanently on your system if you can’t use debuginfod.

This document describes how to set up the debugging symbol packages (*-dbg.deb and *-dbgsym.ddeb). You might need to do this when you are performing tasks like a Backtrace or using Valgrind.

Debuginfod

If you are on Ubuntu Jammy (22.04) or later, you don’t need to worry about installing debug symbol packages since the Ubuntu project maintains a Debuginfod server. GNU Debugger (GDB) and other debuginfo-consumer applications support Debuginfod (mostly) out of the box. For more information about it, please refer to our Debuginfod guide.

You will only need to follow the methods outlined in this section if you are on Ubuntu Focal (20.04) or earlier.

Getting -dbgsym.ddeb packages

If you are debugging without debuginfod, your first step will be to enable the ddebs.ubuntu.com repository as described in this section, which will provide access to the -dbgsym packages.

In the rare cases where the -dbgsym package is not available, you might need to install the -dbg package instead. The subsequent section (Manual install of debug packages) provides more information about this case.

Import the signing key

Import the debug symbol archive signing key from the Ubuntu server. On Ubuntu 18.04 LTS and newer, run the following command:

sudo apt install ubuntu-dbgsym-keyring

Create a ddebs.list file

Create an /etc/apt/sources.list.d/ddebs.list by running the following line at a terminal:

echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list

You can also add these repositories in your software sources from the Ubuntu software center or from Synaptic (refer to this article, especially the section on adding other repositories). You will need to add lines like:

deb http://ddebs.ubuntu.com focal main restricted universe multiverse

Note:
Make sure you replace “focal” with the Ubuntu release name you’re using.

Update package list

Run the following to update your package list or click the Reload button if you used the Synaptic Package Manager:

sudo apt-get update

Manual install of debug packages

To install the debug symbol package (*-dbgsym.ddeb) for a specific package, you can now invoke:

sudo apt-get install PACKAGE-dbgsym

For example, to install the debug symbols for xserver-xorg-core:

sudo apt-get install xserver-xorg-core-dbgsym

As mentioned in the section above, some packages will ship their debug symbols via *-dbg.deb packages instead. Using glibc as an example, you can install its debug symbols using:

sudo apt-get install libc6-dbg

This procedure will install the debug symbol package for a single package only. It is likely that the binary uses shared libraries in other packages, and their debug symbols may be needed in order to obtain a readable stack trace or perform other debugging tasks.

The debian-goodies tool

You can use the find-dbgsym-packages command from the debian-goodies package to find debug symbols for a core file, running PID or binary path.

For a binary path it only finds debug symbols for the actual binary itself, and not any dynamically linked library dependencies or other libraries loaded at runtime. For that functionality to work you need to use either a core file or a running PID (which is the preferred method).

This tool will find both -dbg and -dbgsym style packages. However it only finds debug symbols for APT repositories that are currently enabled and updated, so you need to ensure that you enable at least the ddebs.ubuntu.com archive as described above. For a Launchpad PPA or the Ubuntu Cloud Archive you need to add another source line with the component changed from main to main/debug:

sudo apt install debian-goodies
find-dbgsym-packages [core_path|running_pid|binary_path]

“debs” versus “ddebs”

It used to be the case that Debian/Ubuntu maintainers needed to manually create debug symbol packages as part of the packaging process, and included them in the same repository as their binary package. These debug symbol packages had the -dbg.deb suffix, so for example, both the apache2-bin.deb package and the apache2-dbg.deb package would be placed in the same repository. However, since the process is a manual one, not every maintainer did this, and the .deb package was not always kept up-to-date.

Modern package building tools automatically create the debug symbol packages when binary packages are compiled on Ubuntu servers, so the older (manual) process is no longer used. These automatically-created debug symbol packages have the -dbgsym.ddeb suffix. Unlike -dbg.deb packages, -dbgsym.ddeb packages are hosted in their own separate repository, since these packages are used relatively rarely.

You can choose to use either -dbg.deb or -dbgsym.ddeb packages, but for any given binary package only one debug symbol package can be used at once.

This page was last modified 3 months ago. Help improve this document in the forum.