2

I would like to remove any packages that I installed from third party repositories. I recently installed some backports from PPA repositories, and I suspect one of them broke my Ubuntu 12.04 server system.

Is there any way I can list all currently installed packages in that are not available in the repositories, or, which version is higher than the one available in the current repositories?

Jeroen Ooms
  • 2,187
  • 7
  • 32
  • 51

2 Answers2

3

First you should install and use deborphan. This will find libraries and things that are no longer required.

Aptitude can find obsolete packages with aptitude search '~o'

My pre-aptitude command for doing this is below. But this shows some false positives when I just tested on a multiarch setup.

# the one-line command
diff -u <(dpkg --get-selections | awk ' {print "Package: " $1}' | sort -u) \
        <(zcat /var/lib/apt/lists/*_Packages.gz | grep 'Package: ' | sort -u) \
  | egrep '^\-'

#  breaking it down down with some comments

#  See all the installed packages
# dpkg --get-selections | awk ' {print "Package: " $1}' | sort -u

#  see all the available packages
# zcat /var/lib/apt/lists/*_Packages.gz | grep 'Package: ' | sort -u

#  compare and find the installed that are no longer available.
# diff -u <( installed ) <( available ) | egrep '^\-'
Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • Thanks. I removed some packages but didn't fix the problem. Any idea as to detect installed backports? I.e. where the installed version is higher than the current repository version? – Jeroen Ooms Mar 15 '13 at 04:13
0

Two clean ways of doing this that both work the same:

sudo add-apt-repository --remove ppa:whatever/ppa

Or

sudo ppa-purge ppa:repository-name/subdirectory
BullShark
  • 64
  • 2
  • Will this downgrade packages that were upgraded by the PPA? – Jeroen Ooms Apr 19 '13 at 17:44
  • Suggest you look at the man page next time. man ppa-purge says "This script provides a bash shell script capable of automatically down‐grading all packages in a given PPA back to the ubuntu versions." – BullShark Apr 20 '13 at 20:42