Assuming I have a core dump from a Debian system, where I know the build-ids of the libraries used in the dump, but don't know the exact versions, is there a way to find those files?

For example, the command eu-unstrip -n --core my-core-file gives me a list of build-ids from a core dump, like this:

0x7f09b7228000+0x272108 1b72306ef00166fe1511d57140b50f5ce341170e@0x7f09b72281d8 /lib/x86_64-linux-gnu/libpcre.so.3 - libpcre.so.3

0x7f09bac07000+0x219208 908b5a955d0a73fb8d31e0f927d0cdba810cb300@0x7f09bac071d8 /lib/x86_64-linux-gnu/libz.so.1 - libz.so.1

0x7f09bb06c000+0x20fd88 06ea95ca3df11e4a8e85791c1ff89a49fc3fe9c1@0x7f09bb06c1d8 /lib/x86_64-linux-gnu/libbz2.so.1.0 - libbz2.so.1.0

Based on these library names and build-ids, is there a command, web service or anything that can tell me which package or file versions these build-ids correspond to, so that I can download them?


As far as I’m aware there’s no tool to search for build-ids (but see further down).

You can use apt-file to search for packages providing the libraries in use. Install it, update the indexes, then run

apt-file search /lib/x86_64-linux-gnu/libpcre.so.3
apt-file search /lib/x86_64-linux-gnu/libz.so.1
apt-file search /lib/x86_64-linux-gnu/libbz2.so.1.0

To use build-ids, you’ll need to look through Packages files manually. The index for debug repositories includes the build-ids; for example

$ apt show libbz2-1.0-dbgsym
Package: libbz2-1.0-dbgsym
Version: 1.0.6-8.1
Auto-Built-Package: debug-symbols
Priority: extra
Section: debug
Source: bzip2
Maintainer: Anibal Monsalve Salazar <anibal@debian.org>
Installed-Size: 68.6 kB
Depends: libbz2-1.0 (= 1.0.6-8.1)
Homepage: http://www.bzip.org/
Build-Ids: 06ea95ca3df11e4a8e85791c1ff89a49fc3fe9c1
Download-Size: 51.5 kB
APT-Sources: http://debug.mirrors.debian.org/debian-debug stretch-debug/main amd64 Packages
Description: Debug symbols for libbz2-1.0

To search for the build-ids directly, grep through /var/lib/apt/*Packages:

grep -l 06ea95ca3df11e4a8e85791c1ff89a49fc3fe9c1 /var/lib/apt/lists/*Packages

You can combine this with less to see the name and version of the package:

grep -l 06ea95ca3df11e4a8e85791c1ff89a49fc3fe9c1 /var/lib/apt/lists/*Packages | xargs -r less -p06ea95ca3df11e4a8e85791c1ff89a49fc3fe9c1

This will only work if you have the indexes for debug packages; to get those, add a file to /etc/apt/sources.list.d, call it for example debug.sources, containing

Types: deb
URIs: http://debug.mirrors.debian.org/debian-debug/
Suites: stretch-debug testing-debug unstable-debug experimental-debug
Components: main

This will download the debug indexes for the main component in stable, testing, unstable and experimental.

Some packages (such as libpcre3) don’t build -dbgsym packages, so they’re not covered by the search above. There’s a corresponding libpcre3-dbg but as far as I can tell none of the versions currently in the archives match your build-id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.