Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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'd like to retrieve a list of installed packages that have no install candidate (e.g., because I removed an apt source file entry). How would I do that on Debian-based systems?

share|improve this question
You could use apt-show-versions and grep for No available version in archive. – Faheem Mitha Jan 21 '12 at 15:31
up vote 8 down vote accepted

With Aptitude, search for the ?obsolete pattern, possibly with a custom display format.

aptitude -F '%p' search '?obsolete'
share|improve this answer
I knew I should have started learning command-line package management using aptitude instead of apt. Thanks, straightforward and faster than the other answer. :) – htorque Jan 21 '12 at 17:09

This one was updated:

for package in $(dpkg -l | awk '/ii/{print $2}'); do
     if ! grep -xq "Package: $package" /var/lib/apt/lists/*Packages; then
         echo $package

Using apt-cache policy:

for package in $(dpkg -l | awk '/ii/{print $2}'); do
    if ! apt-cache policy $package | grep -q '[0-9] http://'; then
        echo $package
share|improve this answer
Unfortunately this doesn't seem to care about :i386 packages on systems with multiarch support. Parsing the output of apt-cache policy <package> would work, but that would be rather slow I imagine. – htorque Jan 21 '12 at 9:59
Give me an example of what the output of apt-cache policy would look like on your multiarch system. – Teresa e Junior Jan 21 '12 at 10:04
The example for such a package with no install candidate... – Teresa e Junior Jan 21 '12 at 10:07
paste.ubuntu.com/811658 - but I got another idea: trying to apt-get download -s all installed packages. – htorque Jan 21 '12 at 10:08
Your apt-cache policy doesn't help and apt-get download doesn't exist in Debian. – Teresa e Junior Jan 21 '12 at 10:24

Just update your packages with

sudo apt-get install update

In most cases it will solve the issues.If any unmet dependency issues are arises use this one

sudo apt-get -f install
share|improve this answer

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.