Web lists-archives.com

Re: prevent "dpkg -l" from showing nonexisting packages

On 2017-03-13 00:23:54 -0400, kamaraju kusumanchi wrote:
> On Sat, Mar 11, 2017 at 12:08 PM, Brian <ad44@xxxxxxxxxxxxxxx> wrote:
> > On Sat 11 Mar 2017 at 10:21:13 -0500, kamaraju kusumanchi wrote:
> >>                                      How to change this behaviour so
> >> it only shows packages that are available in repositories?
> >
> > Impossible. 'dpkg -l' only shows packages which have files on the system.
> >
> > Perhaps you would like to reframe your query?
> Let me rephrase my question. If "dpkg -l" cannot do it, is there some
> other command that will only show packages from the current
> repositories?

Perhaps apt-show-versions, which can check whether a package
is in a repository. You will need options and/or grep.

For instance, on one of my machines, I get in the output:

unison2.40.102:amd64 2.40.102-3 installed: No available version in archive

i.e. apt-show-versions detects that this package is installed,
but no longer in any declared repository.

AFAIK, aptitude can do similar things.

> If "dpkg -l" only shows packages which files on the system, what files
> should I remove, so that packages such as flashplayer-mozilla will not
> show up in its output?

"rc" means that the package has been removed but its conffiles are
still there (i.e. the package has not been "purged").

You can get the list of remaining files with:

  dpkg -L <package_name>

You can purge the package (i.e. remove all the conffiles) with:

  dpkg -P <package_name>

> If there is no generic way of doing it, can I do it just for just
> flashplayer-mozilla package?

Note: There is a package that downloads the non-free Flash plugin.
These files are not from the package, thus will not be detected
by dpkg. If you have used it and purged the package, you should
manually check that everything has been cleaned up (perhaps this
package ensures that, though).

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)