Both Percona Server for MongoDB and vanilla MongoDB packages do not contain debug symbols by default. This is because the debug symbols package can be up to a 3GB download depending on the version and target platform. Fortunately, you only need debug symbols in those rare cases when you have got a serious enough issue, and you really want to debug it. So for most users, it is an absolutely reasonable decision to not download gigabytes of debug symbols by default.
This blog post provides pointers to where to get debug symbols for Percona Server for MongoDB or vanilla MongoDB.
Percona Server for MongoDB
Using the corresponding package manager
Percona provides debug symbols packages for Percona Server for MongoDB. It is recommended to install Percona packages from official Percona repositories using the corresponding tool for your system:
- Install using apt if you are running Debian or Ubuntu
- Install using yum if you are running Red Hat Enterprise Linux or CentOS
Installing debug symbols manually
You can also download packages from the Percona website and install them manually using dpkg or rpm.
To get debug symbols for Percona Server for MongoDB, go to the downloads page. Then look for the “Percona Server for MongoDB” section and click the “Download X.X Now” button corresponding to the version you are interested in.
On the new page, select the minor release version from the Version: dropdown list and the target platform from the Software: dropdown list. This will reveal a list of available packages for the selected platform. You can search for a dbg or debuginfo package (depending on the target platform) and download it.
In most cases, it is possible to download debug symbols as a special package or as part of the “All Packages” bundle. For example, on the Percona Server for MongoDB 5.0.98 page for Ubuntu 20.04 you can download either a separate percona-server-mongodb-dbg_5.0.98.focal_amd64.deb package or all packages bundle which contains debug symbols package: percona-server-mongodb-5.0.9 8-r15a95b4-focal-x86_64-bundle.tar
MongoDB Debug Symbols
There are no debug symbols packages provided by MongoDB Inc., but fortunately, it is possible to download binary tarballs containing debug symbols files from the non-advertised location: https://www.mongodb.org/dl/linux/x86_64
Be careful – the above link opens a huge list containing thousands of tgz archives created since 2009. This is virtually the full MongoDB history, in a single directory.
The names of those files are talking for themselves: it’s a combination of architecture, platform, and MongoDB version.
For example, there are two files for MongoDB 5.0.9 on Ubuntu 20.04:
- http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu20045.0.9.tgz
- http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-debugsymbols-5.0.9.tgz
The first of those files are just server core binaries:
1 2 3 4 5 6 7 8 9 | $ tar -tf mongodb-linux-x86_64-ubuntu2004-5.0.9.tgz mongodb-linux-x86_64-ubuntu2004-5.0.9/LICENSE-Community.txt mongodb-linux-x86_64-ubuntu2004-5.0.9/MPL-2 mongodb-linux-x86_64-ubuntu2004-5.0.9/README mongodb-linux-x86_64-ubuntu2004-5.0.9/THIRD-PARTY-NOTICES mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/install_compass mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/mongo mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/mongod mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/mongos |
The second file contains corresponding debug symbols files:
1 2 3 4 5 6 7 8 | $ tar -tf mongodb-linux-x86_64-ubuntu2004-debugsymbols-5.0.9.tgz mongodb-linux-x86_64-ubuntu2004-5.0.9/LICENSE-Community.txt mongodb-linux-x86_64-ubuntu2004-5.0.9/MPL-2 mongodb-linux-x86_64-ubuntu2004-5.0.9/README mongodb-linux-x86_64-ubuntu2004-5.0.9/THIRD-PARTY-NOTICES mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/mongo.debug mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/mongod.debug mongodb-linux-x86_64-ubuntu2004-5.0.9/bin/mongos.debug |
Thus, you can use those symbol files with gdb to analyze the core dump file if you have one or to debug a running instance of MongoDB Community Edition.
Each xxxx.debug file is a debug symbols file for the corresponding xxxx binary. If you accidentally try to debug with a mismatched symbols file, gdb will politely inform you about that:
1 2 3 4 | Reading symbols from ./mongod... warning: the debug information found in "/home/igor/5.0.9/bin/mongod.debug" does not match "/home/igor/5.0.9/bin/mongod" (CRC mismatch). (no debugging symbols found)...done. |
This especially can happen if you upgrade the binaries package but not debug symbols.
Conclusion
It is a really rare case when you will need to debug Percona Server for MongoDB or MongoDB, but if you really need to I hope this debug symbols information will save a few minutes for you.
Happy debugging!