3

Let's say I installed bunch of packages from external PPA repositories and they modified or replaced the existing default packages in the system. Assume that then I remove those PPAs from the apt-sources and I no longer remember their names. So then how do I use ppa-purge or downgrade those packages to the default ones?

Is there way I could list/find all the packages installed form non-Ubuntu software repositories? Then I could reverts back to the official packages if necessary.

1
  • 1
    I can't think of a quick way, but both aptitude and synaptic list such packages in the obsolete packages section.
    – muru
    Aug 10, 2014 at 10:27

2 Answers 2

2

You could use apt-forktracer

To install it you must first enable the Universe Repository and then install it either via the software center or with the command sudo apt-get install apt-forktracer

Here's an excerpt from the man page:

apt-forktracer analyzes each installed package separately, reporting on the standard output these packages which are in a "non-standard" state. What "non-standard" means depends on the mode of program operation:

default (non-verbose) mode
    this state means packages in an incorrect state (e.g. no candidate version) or packages whose candidate version is different than the newest available official version.

verbose mode
    this state also includes packages whose installed version is different from the candidate version 

And here's an example of the default output:

libavformat57 (7:3.1~~git20160413.62652~ubuntu14.04.1) [LP-PPA-motumedia-ffmpeg-daily: 7:3.1~~git20160413.62652~ubuntu14.04.1]
libavresample3 (7:3.1~~git20160413.62652~ubuntu14.04.1) [LP-PPA-motumedia-ffmpeg-daily: 7:3.1~~git20160413.62652~ubuntu14.04.1]
libavfilter6 (7:3.1~~git20160413.62652~ubuntu14.04.1) [LP-PPA-motumedia-ffmpeg-daily: 7:3.1~~git20160413.62652~ubuntu14.04.1]

For more information see man apt-forktracer

Now that we know the package names in question we can remove (or purge them)

Other methods as @muru notes in his comment are to:

A) use synaptic to locate the obsolete packages.

synaptic-obsolete

You can then select those you wish to remove or completely remove as shown below:

synaptic-removal

Or

B) use aptitude

Upon launching aptitude Select Actions -> Become root and after entering your password Select "Obsolete and Locally Created Packages" as shown below:

aptitude-obsolete

Navigate to the package you want to remove as shown below:

aptitude-remove

Press the - key to mark the package for removal. When you've completed matking the packages you wish to remove press g to remove them Or is you've made a mistake in marking, Ctrlu to Undo yiour changes for the session.

Sources:

https://manpages.debian.org/testing/apt-forktracer/apt-forktracer.8.en.html

http://aptitude.alioth.debian.org/doc/en/ch02s01s02.html

1

To build on the answer above, I found forktracer to be invaluable for this. After many PPAs enabled and disabled, here's a way to downgrade back to the "official" versions.

First, generate a list of packages using apt-forktracer:

apt-forktracer | grep Ubuntu: | sed 's/\([^ ]*\).*Ubuntu: \([^] ]*\).*/\1=\2/' > ubuntu-packages.list

The sed expression formats it in a way you can use with apt-get install.

Then you simply downgrade them all:

sudo apt-get install --mark-auto $(cat ubuntu-packages.list)

It will warn you if it intends to remove a dangerous package, but you should definitely check the list of packages it will remove before you proceed.

In my example, I had to edit ubuntu-packages.list to remove a downgrade of libcrypt1 because it would have taken libc with it, which is not what I wanted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .