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
Zanna
  • 72,312

1 Answers1

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.
Ravexina
  • 57,256