6

I need to revert my version of gdb back to a previous release so that it is compatible with a certain tool. I currently have gdb 7.7.1 installed. If I enter gdb into the terminal and hit enter, gdb runs. However, when I run sudo apt-get remove gdb, it says this:

$ sudo apt-get remove gdb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'gdb' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

This is the case when I use sudo dpkg -r gdb as well. How can I fix this so that the program is first recognized and then removable?

Ubuntu 14.04.2 LTS
3.13.0-53-generic
7

First find out what binary will be executed when you run gdb using which command:

which gdb

it's outputs a path like: /usr/bin/gdb then we should search which package installed this file using dpkg:

dpkg -S /usr/bin/gdb

or even:

dpkg -S $(which gdb)

so it gives us a package name like :gdb: /usr/bin/gdb. then remove that package: sudo apt remove gdb in this case.


As an alternative you can just reinstall the older version, first see what versions are available to you:

apt-cache madison gdb | grep -iv sou
  gdb | 7.11.1-0ubuntu1~16.04 | http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
  gdb | 7.11-0ubuntu1 | http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages

then install the older version it will take care of newer version removal itself:

$ sudo apt install gdb=7.11-0ubuntu1

The following packages will be DOWNGRADED:
  gdb
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
| improve this answer | |
  • 1
    FYI - Thanks to your solution I was able to detect that it was called 'gdb-minimal' from dpkg -S – the_endian May 31 '17 at 10:06

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.