Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

Or

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

 
discard

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.