Installing debuginfo packages

Craig Ringer
Craig Ringer

Most Linux distributions split debug information into packages that are separate from the main binaries and related files. The lack of debug info makes it difficult to use diagnostic tools to find and fix faults, so we strongly advise all users to install the debug info packages.

The PGDG yum and apt repositories archive packages for older point releases so you cannot reliably expect to be able to install debuginfo packages on-demand when you need them. Install them at the same time you install PostgreSQL.

DISCLAIMER: This article is still work in progress as it does not address all possible cases. We are reorganising this article in several ones, one per distribution. We are also working on improving delivery of these packages.

Debug info is relatively large and not needed during normal operations, but has no performance impact. We strongly advise all users to install it as part of their routine deployments because it can be difficult to find and install when you actually need it during an emergency.

Not having debug info can make the process of diagnosing and fixing a problem slower, and make it difficult or impractical to determine what went wrong in order to prevent it from happening next time.

How to install debug info depends on the Linux distributon and how PostgreSQL was installed.

RHEL, CentOS and Fedora

Debug info packages have the same name as the main package, with a -debuginfo suffix. Install the debug info packages for PostgreSQL, its libs, and all extensions you use.

These instructions assume you installed PostgreSQL from a repository with yum or dnf. If you hand-downloaded packages without configuring a repository you'll have to get the debuginfos the same way.

If you have multple major versions of PostgreSQL installed you must repeat these commands for each major version. Make sure you install debuginfo for extensions you use too, like bdr, pglogical, etc.

Fedora:

  • sudo dnf install dnf-plugins-core
  • sudo dnf debuginfo-install postgresql10 postgresql10-contrib postgresql10-server postgresql10-libs

If you use pglogical or bdr, please install the pglogical and bdr debuginfos at the same time.

RHEL7/CentOS7/RHEL6/CentOS 6:

  • sudo yum install yum-utils
  • sudo debuginfo-install postgresql10 postgresql10-contrib postgresql10-server postgresql10-libs

If installation reports that no such packages exist and your running PostgreSQL is more than a few minor versions behind the latest release then the packages have probably been archived off the main repository server. There is a separate historic archive of packages but it does not function as a true yum repository, so you have to find the matching packages manually. It is accessed with URLs like https://yum-archive.postgresql.org/9.3/redhat/rhel-$releasever-$basearch e.g. https://yum-archive.postgresql.org/9.3/redhat/rhel-7Server-x86_64. These variables are defined in /etc/os-release as ; see also rpm -qilf /etc/issue.

Debian and Ubuntu

Debug info packages have the same name as the main package, with a -dbgsym or -dbg suffix. Install the debug info packages for PostgreSQL, its libs, and all extensions you use. You should also install the -dbgsrc packages for PostgreSQL its self.

These instructions assume you installed PostgreSQL from a repository with apt-get, aptitude or similar. If you hand-downloaded packages without configuring a repository you'll have to get the debuginfos the same way.

If you have multple major versions of PostgreSQL installed you must repeat these commands for each major version.

See the Debian wiki or ubuntu wiki as appropriate for instructions on setting up sources.listand installing debug info packages. You want a package named postgresql-10-dbg, postgresql-9.6-dbg, etc as appropriate for your version.

If installation reports that no such packages exist and your running PostgreSQL is more than a few minor versions behind the latest release then the packages have probably been archived off the main repository server. There is a separate historic archive of packages but it does not function as a true yum repository, so you have to find the matching packages manually. See pgapt FAQ.

Built from source or with in-house custom packaging procedures

If PostgreSQL was installed from source, debug info is present if PostgreSQL was built with ./configure --enable-debug.

If not, it must be recompiled. The new debug binaries cannot be used to debug core files or running processes that used the old non-debug binaries.

We strongly recommend that --enable-debug always be used to configure PostgreSQL. If you're building with any normal compiler like gcc or llvm this will produce normally-optimised PostgreSQL binaries that perform the same as non-debug binaries, they're just larger on disk. Use a configure command like:

CFLAGS="-O2 -ggdb3" ./configure --enable-debug

Note: do not use other debug options like --enable-cassert in production.

Was this article helpful?

0 out of 0 found this helpful