I am looking for a way to find all packages that have been installed on
my system according to dpkg, but don't have a matching entry in Apt.
I would like to do it in a very programatic way without relying on
output aimed for human if possible. Just grepping the output of dpkg -l,
for example, means I have to exclude headers and ensure that the column doesn't get truncated or otherwise mangled.
you could check for obsolete packages, depending on the apt version, with
$ apt list '~o'
Hi Loren,
On Sun, Feb 02, 2025 at 11:29:45PM -0800, Loren M. Lang wrote:
I am looking for a way to find all packages that have been installed on
my system according to dpkg, but don't have a matching entry in Apt.
Packages installed with dpkg -i *do* show in apt, so can you be more
specific about what you are looking for?
Example:
$ sudo dpkg -i ~/Downloads/zola_0.19.0-1_amd64_bookworm.deb
$ apt show zola
Package: zola
Version: 0.19.0-1
Status: install ok installed
Priority: optional
Section: web
Maintainer: Martin Simon <[email protected]>
Installed-Size: 38.1 MB
Depends: libc6 (>= 2.35), libgcc-s1 (>= 4.2)
Homepage: https://github.com/getzola/zola
Download-Size: unknown
APT-Manual-Installed: yes
APT-Sources: /var/lib/dpkg/status
Description: A fast static site generator in a single binary with everything built-in.
Zola is a static site generator (SSG), similar to Hugo, Pelican, and Jekyll
(for a comprehensive list of SSGs, please see Jamstack). It is written in
Rust and uses the Tera template engine, which is similar to Jinja2, Django
templates, Liquid, and Twig. Content is written in CommonMark, a strongly
defined, highly compatible specification of Markdown.
I would like to do it in a very programatic way without relying on
output aimed for human if possible. Just grepping the output of dpkg -l, for example, means I have to exclude headers and ensure that the column doesn't get truncated or otherwise mangled.
dpkg-query is usually used for structured queries of the dpkg database.
Thanks,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting
On Mon, Feb 3, 2025 at 5:16 PM Loren M. Lang <[email protected]> wrote:
Basically, I want to identify any software that I couldn't reinstall onWill this work as a starting place for you?
a fresh install of Debian from the official Debian archives.
comm -23 <(dpkg-query -W -f '${Package} ${Version}\n' | sort -u)
<(apt-cache dumpavail | awk '/^Package:/ {package = $NF} /^Version:/
{version = $NF} /^$/ {print package, version}' | sort -u)
.
gene@coyote:/$ sudo -i
root@coyote:~# comm -23 <(dpkg-query -W -f '${Package} ${Version}\n' | sort -u)
<(apt-cache dumpavail | awk '/^Package:/ {package = $NF} /^Version:/
{version = $NF} /^$/ {print package, version}' | sort -u)
comm: missing operand after ‘/dev/fd/63’
Try 'comm --help' for more information.
-bash: /dev/fd/63: Permission denied
On Mon, Feb 3, 2025 at 5:16 PM Loren M. Lang <[email protected]> wrote:
Basically, I want to identify any software that I couldn't reinstall on
a fresh install of Debian from the official Debian archives.
Will this work as a starting place for you?
comm -23 <(dpkg-query -W -f '${Package} ${Version}\n' | sort -u)
<(apt-cache dumpavail | awk '/^Package:/ {package = $NF} /^Version:/
{version = $NF} /^$/ {print package, version}' | sort -u)
On Mon, Feb 03, 2025 at 23:33:50 -0500, gene heskett wrote:Thank you, you were correct, and I fed it to wc -l to get 3807 in the
gene@coyote:/$ sudo -iIs there a newline in the middle of this command that shouldn't be
root@coyote:~# comm -23 <(dpkg-query -W -f '${Package} ${Version}\n' | sort >> -u)
<(apt-cache dumpavail | awk '/^Package:/ {package = $NF} /^Version:/
{version = $NF} /^$/ {print package, version}' | sort -u)
comm: missing operand after ‘/dev/fd/63’
Try 'comm --help' for more information.
-bash: /dev/fd/63: Permission denied
there?
The errors that you're seeing here are consistent with the comm -23
command only having ONE of the <() process substitutions as an argument,
and then the second <() proc sub being on a line by itself.
hobbit:~$ sudo -i
[sudo] password for greg:
root@hobbit:~# <(echo hi)
-bash: /dev/fd/63: Permission denied
I'm guessing you pasted the command out of a mail program or web browser,
in which the code had an extra newline added.
There should be a space (not a newline) between "-u)" and "<(apt-cache".
.
On 2/3/25 21:10, Mike Castle wrote:
On Mon, Feb 3, 2025 at 5:16 PM Loren M. Lang <[email protected]> wrote:
Basically, I want to identify any software that I couldn't reinstall onWill this work as a starting place for you?
a fresh install of Debian from the official Debian archives.
comm -23 <(dpkg-query -W -f '${Package} ${Version}\n' | sort -u) <(apt-cache dumpavail | awk '/^Package:/ {package = $NF} /^Version:/ {version = $NF} /^$/ {print package, version}' | sort -u)
looking for any clue that might fix my busted bookworm install, however this will not execute, either as me or sudo: error reported is no permission for /dev/fd/63 when in fact /dev/fd/ only contains 0, 1, 2, 3 as subdirs.
.
Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
On Tue, Feb 4, 2025 at 4:04 AM Andrew M.A. Cater <[email protected]> wrote:
apt list '~o'
Where is '~o' documented? apt(1) mentions dpkg-query, but I couldn't
find it mentioned there either.
On Tue, Feb 4, 2025 at 8:34 AM Greg Wooledge <[email protected]> wrote:
On Tue, Feb 04, 2025 at 08:12:42 -0800, Mike Castle wrote:
On Tue, Feb 4, 2025 at 4:04 AM Andrew M.A. Cater <[email protected]> wrote:
apt list '~o'
Where is '~o' documented? apt(1) mentions dpkg-query, but I couldn't find it mentioned there either.
It's documented as part of "aptitude", I believe, but it's not in the aptitude(8) man page, because that would be too easy.
Ahhh. Never used aptitude, not even installed on my systems. (Then
again, I still use dselect sometimes so... )
On Tue, Feb 04, 2025 at 08:12:42 -0800, Mike Castle wrote:
On Tue, Feb 4, 2025 at 4:04 AM Andrew M.A. Cater <[email protected]> wrote:
apt list '~o'
Where is '~o' documented? apt(1) mentions dpkg-query, but I couldn't
find it mentioned there either.
It's documented as part of "aptitude", I believe, but it's not in the aptitude(8) man page, because that would be too easy.
<https://manpages.debian.org/bookworm/aptitude/aptitude.8.en.html>
includes this paragraph (buried deep, searching for ~ eventually gets
to it):
This command accepts package names or patterns as arguments. If
the string contains a tilde character (“~”) or a question mark
(“?”), it will be treated as a search pattern and every package
matching the pattern will be considered (see the section “Search
Patterns” in the aptitude reference manual).
- apt-patterns(7)
On Tue, Feb 04, 2025 at 11:23:58AM -0500, Greg Wooledge wrote:
<https://manpages.debian.org/bookworm/aptitude/aptitude.8.en.html>
includes this paragraph (buried deep, searching for ~ eventually gets
to it):
This command accepts package names or patterns as arguments. If
the string contains a tilde character (“~”) or a question mark
(“?”), it will be treated as a search pattern and every package
matching the pattern will be considered (see the section “Search
Patterns” in the aptitude reference manual).
I think it's just searching for a status matching ?o - so that matches "obsolete", for example.
Trying it with '~i' gives you everything that is i[nstalled], by comparison. That's a long list, going down to zstd.
aptitude list -h gives you more help detail.
On Tue 04 Feb 2025 at 12:15:32 (-0500), Greg Wooledge wrote:
On Wed, Feb 05, 2025 at 00:00:13 +0700, Max Nikulin wrote:
- apt-patterns(7)
Why isn't this linked/referenced from apt(8) or apt-get(8) or aptitude(8)? I just checked all three, and it's not on any of them.
That's slightly easier to remember than <https://www.debian.org/doc/manuals/aptitude/ch02s04s05.en.html>, I suppose. Not that I'll remember it by the next time this question is
asked again. Not without it being referenced from somewhere that
humans will actually look.
I'm in the habit of typing:
man apt- <TAB> <TAB>
I would not fancy the job of coordinating or unifying all the APT documentation that's sprung up over the years.
On Wed, Feb 05, 2025 at 00:00:13 +0700, Max Nikulin wrote:
- apt-patterns(7)
Why isn't this linked/referenced from apt(8) or apt-get(8) or aptitude(8)?
I just checked all three, and it's not on any of them.
That's slightly easier to remember than <https://www.debian.org/doc/manuals/aptitude/ch02s04s05.en.html>, I
suppose. Not that I'll remember it by the next time this question is
asked again. Not without it being referenced from somewhere that
humans will actually look.
On Tue, Feb 04, 2025 at 12:15:32PM -0500, Greg Wooledge wrote:
On Wed, Feb 05, 2025 at 00:00:13 +0700, Max Nikulin wrote:
- apt-patterns(7)
Why isn't this linked/referenced from apt(8) or apt-get(8) or aptitude(8)? I just checked all three, and it's not on any of them.
It is references in the SEE ALSO section of the apt(8) man page which is
how I found it,
Also, it is references earlier under the
list subcommand:
list
list is somewhat similar to dpkg-query --list in
that it can display a list of packages satisfying
certain criteria. It supports glob(7) patterns for
matching package names, apt-patterns(7), as well as
options to list installed (--installed),
upgradeable (--upgradeable) or all available (--all-versions) versions.
I am still trying to figure out where that data comes from. Maybe it literally is just what I asked for, matching packages from the installed
list and without a matching entry in a current Apt repository list file?
So, then will my broadcom driver appear in the obsolete list if I
comment out the non-free-firmware section from sources.list? I'll have
to test that out.
On Tue, Feb 04, 2025 at 11:04:16 -0800, Loren M. Lang wrote:
On Tue, Feb 04, 2025 at 12:15:32PM -0500, Greg Wooledge wrote:
On Wed, Feb 05, 2025 at 00:00:13 +0700, Max Nikulin wrote:
- apt-patterns(7)
Why isn't this linked/referenced from apt(8) or apt-get(8) or aptitude(8)? I just checked all three, and it's not on any of
them.
It is references in the SEE ALSO section of the apt(8) man page
which is how I found it,
Not in Bookworm, it isn't. But you're saying it's been improved in
Trixie or something? That's good!
Also, it is references earlier under the
list subcommand:
list
list is somewhat similar to dpkg-query --list
in that it can display a list of packages satisfying
certain criteria. It supports glob(7)
patterns for matching package names, apt-patterns(7), as well as
options to list installed (--installed),
upgradeable (--upgradeable) or all available (--all-versions) versions.
Hah. All the things I asked for in the message I wrote 5 minutes ago
are apparently already done in some future version of Debian.
On Mon, Feb 03, 2025 at 11:09:58AM +0000, Andy Smith wrote:
Hi Loren,
On Sun, Feb 02, 2025 at 11:29:45PM -0800, Loren M. Lang wrote:
I am looking for a way to find all packages that have been installed on
my system according to dpkg, but don't have a matching entry in Apt.
Packages installed with dpkg -i *do* show in apt, so can you be more
specific about what you are looking for?
Yes, I am specifically trying to find packages that don't match entries
from the package lists downloaded in main, non-free, contrib, etc.
Basically, I want to identify any software that I couldn't reinstall on
a fresh install of Debian from the official Debian archives.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 162:01:48 |
| Calls: | 12,094 |
| Calls today: | 2 |
| Files: | 15,000 |
| Messages: | 6,517,780 |