Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 0 down vote accepted

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

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


sudo ppa-purge ppa:repository-name/subdirectory
share|improve this answer
Will this downgrade packages that were upgraded by the PPA? – Jeroen 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

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 '^\-'
share|improve this answer
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 Mar 15 '13 at 4:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.