The man page for dnf5 says:
list List installed or available packages.
However it doesn't appear to give any more detail, and if I try it:
$ dnf list --available fedora.repo Updating and loading repositories: Repositories loaded. No matching packages to list
which is clearly nonsense. I'm mainly interested in listing packages in a COPR repo, but I seem to be missing something.
Any hints would be appreciated.
poc
On Wed, 4 Jun 2025 at 15:13, Patrick O'Callaghan pocallaghan@gmail.com wrote:
The man page for dnf5 says:
list List installed or available packages.However it doesn't appear to give any more detail, and if I try it:
$ dnf list --available fedora.repo Updating and loading repositories: Repositories loaded. No matching packages to list
which is clearly nonsense. I'm mainly interested in listing packages in a COPR repo, but I seem to be missing something.
Any hints would be appreciated.
I think 'fedora.repo' is throwing it. If I:
$ dnf list $ dnf list --available
I get the expected output. I think if you want just a specific repo, use --repo as well.
$ dnf list --available | wc -l Updating and loading repositories: Repositories loaded. 77772 $ dnf list --available --repo fedora | wc -l Updating and loading repositories: Repositories loaded. 76877 $ dnf list --available --repo updates | wc -l Updating and loading repositories: Repositories loaded. 14287
The global options section under
$ dnf --help
... helped.
On 6/4/25 10:13 AM, Patrick O'Callaghan wrote:
The man page for dnf5 says:
list List installed or available packages.However it doesn't appear to give any more detail, and if I try it:
$ dnf list --available fedora.repo Updating and loading repositories: Repositories loaded. No matching packages to list
which is clearly nonsense. I'm mainly interested in listing packages in a COPR repo, but I seem to be missing something.
Any hints would be appreciated.
poc
Use "dnf repo list" to get the list of IDs for the repos configured on the system (Fedora is "fedora" not "fedora.repo")
then do "dnf --repo=fedora repoquery"
"--available" is the default but there are additional options available to tailor the result.
Patrick O'Callaghan wrote:
The man page for dnf5 says:
list List installed or available packages.However it doesn't appear to give any more detail, and if I try it:
$ dnf list --available fedora.repo Updating and loading repositories: Repositories loaded. No matching packages to list
which is clearly nonsense. I'm mainly interested in listing packages in a COPR repo, but I seem to be missing something.
Any hints would be appreciated.
TLDR: The argument (if any) is a package-specification not a repo file name.
The man page (dnf5-list) says in the synopsis:
dnf5 list [options] [<package-spec>...]
and in the examples it shows:
dnf5 list kernel*
(which it presumes users will know to properly escape in their choice of shell, e.g. dnf list 'kernel*' or dnf list kernel* for sh shells.)
It also points to dnf5-specs(7) for more details on the patterns specification.
On Wed, 2025-06-04 at 11:25 -0400, Todd Zullinger wrote:
The man page (dnf5-list) says in the synopsis:
dnf5 list [options] [<package-spec>...]
and in the examples it shows:
dnf5 list kernel*
(which it presumes users will know to properly escape in their choice of shell, e.g. dnf list 'kernel*' or dnf list kernel* for sh shells.)
So 'dnf list "*"' is what I'm looking for.
Thanks
poc
Patrick O'Callaghan wrote:
On Wed, 2025-06-04 at 11:25 -0400, Todd Zullinger wrote:
The man page (dnf5-list) says in the synopsis:
dnf5 list [options] [<package-spec>...]
and in the examples it shows:
dnf5 list kernel*
(which it presumes users will know to properly escape in their choice of shell, e.g. dnf list 'kernel*' or dnf list kernel* for sh shells.)
So 'dnf list "*"' is what I'm looking for.
No pattern is required. That's what the brackets around '<package-spec>...' signify. Similarly, 'options' are, unsurprisingly, optional. :)
Leaving it off makes more sense, IMO. It provides the same results (this was from f42):
$ dnf -qq list | wc -l 77780
$ dnf -qq list '*' | wc -l 77780
On Wed, 2025-06-04 at 13:18 -0400, Todd Zullinger wrote:
Patrick O'Callaghan wrote:
On Wed, 2025-06-04 at 11:25 -0400, Todd Zullinger wrote:
The man page (dnf5-list) says in the synopsis:
dnf5 list [options] [<package-spec>...]
and in the examples it shows:
dnf5 list kernel*
(which it presumes users will know to properly escape in their choice of shell, e.g. dnf list 'kernel*' or dnf list kernel* for sh shells.)
So 'dnf list "*"' is what I'm looking for.
No pattern is required. That's what the brackets around '<package-spec>...' signify. Similarly, 'options' are, unsurprisingly, optional. :)
Leaving it off makes more sense, IMO.
Of course. I did know that in fact.
Nonetheless when I wanted to list the packages from a specific repo (rather than everything) I tried:
$ dnf list --repo=copr:copr.fedorainfracloud.org:lizardbyte:beta|wc -l Updating and loading repositories: Repositories loaded. 3522
However that's a small repo with only a couple of packages, not over 3500:
$ dnf list|grep copr:copr.fedorainfracloud.org:lizardbyte:beta Updating and loading repositories: Repositories loaded. Sunshine.x86_64 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta Sunshine.src 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta
I would have expected those two commands to have listed essentially the same set of packages.
poc
On 6/4/25 7:13 AM, Patrick O'Callaghan wrote:
The man page for dnf5 says:
list List installed or available packages.However it doesn't appear to give any more detail, and if I try it:
$ dnf list --available fedora.repo Updating and loading repositories: Repositories loaded. No matching packages to list
which is clearly nonsense. I'm mainly interested in listing packages in a COPR repo, but I seem to be missing something.
Any hints would be appreciated.
poc
Hi Patrick,
Not what you asked, BUT WHEN DOES THAT STOP ME !!!! <maniacal laughter>
Whenever I do a "dnf list", I always add ... | grep -i fragment_of_what_I_am_looking_for
Makes me a happy camper.
-T
On Wed, 2025-06-04 at 14:37 -0700, ToddAndMargo via users wrote:
Whenever I do a "dnf list", I always add ... | grep -i fragment_of_what_I_am_looking_for
Makes me a happy camper.
Yes I know. I'm still trying to get my head around the actual logic of the dnf command options. I'm sure it's there (I use it all the time) but the subtler parts of it still escape me.
poc
Patrick O'Callaghan wrote:
On Wed, 2025-06-04 at 13:18 -0400, Todd Zullinger wrote:
Leaving it off makes more sense, IMO.
Of course. I did know that in fact.
:)
Nonetheless when I wanted to list the packages from a specific repo (rather than everything) I tried:
$ dnf list --repo=copr:copr.fedorainfracloud.org:lizardbyte:beta|wc -l Updating and loading repositories: Repositories loaded. 3522
However that's a small repo with only a couple of packages, not over 3500:
$ dnf list|grep copr:copr.fedorainfracloud.org:lizardbyte:beta Updating and loading repositories: Repositories loaded. Sunshine.x86_64 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta Sunshine.src 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta
I would have expected those two commands to have listed essentially the same set of packages.
I think that's because you need to add --available to the list subcommand to not include all the installed packages. Per dnf5-list(8):
--installed List only installed packages.
--available List only available packages.
In a Fedora 42 container:
# check the package count from rpm, for comparison with # dnf list --installed $ rpm -qa | grep -v ^gpg-pubkey | wc -l 123
$ dnf -qq list --installed | tail -n+2 | wc -l 123
$ dnf -qq --repo=fedora-cisco-openh264 list --installed | tail -n+2 | wc -l 123
$ dnf -qq --repo=fedora-cisco-openh264 list --available | tail -n+2 | wc -l 3
$ dnf -qq --repo=fedora-cisco-openh264 list --available Available packages mozilla-openh264.x86_64 2.4.1-2.fc42 fedora-cisco-openh264 openh264.x86_64 2.4.1-2.fc42 fedora-cisco-openh264 openh264-devel.x86_64 2.4.1-2.fc42 fedora-cisco-openh264
I think it's a buglet that even with -qq the 'Installed packages' and 'Available packages' headers are printed. But that's just another tangent.
Patrick O'Callaghan wrote:
On Wed, 2025-06-04 at 14:37 -0700, ToddAndMargo via users wrote:
Whenever I do a "dnf list", I always add ... | grep -i fragment_of_what_I_am_looking_for
Makes me a happy camper.
Yes I know. I'm still trying to get my head around the actual logic of the dnf command options. I'm sure it's there (I use it all the time) but the subtler parts of it still escape me.
The documentation isn't too bad. And for dnf5, they've split it up a bit which *might* make it seem less onerous to read through.
There are plenty of things which require following to another man page (or web page if you view the online documentation (https://dnf5.readthedocs.io/).
That allows you to get the specifics for the command you want and follow up for details on the other parts which make you curious, in most cases.
I know many people still use 'rpm -qa | grep ...' rather than take advantage of the simple matching provide by rpm. It's mildly wasteful, but for an interactive command it doesn't materially affect the time.
For me, I usually prefer the more concise version of a command without having to pipe to another utility. The time I save typing commands clearly goes into typing long-winded replies. ;)
One reason to avoid pipes when you can is that there are times when writing shell scripts where it matters. Not a lot. But if you know how to do something without a bunch of needless pipes, every so often it pays off. At the least, it saves some typing at the command line.
On Wed, 2025-06-04 at 18:29 -0400, Todd Zullinger wrote:
I think that's because you need to add --available to the list subcommand to not include all the installed packages. Per dnf5-list(8):
--installed List only installed packages.
--available List only available packages.
Yes, adding '--available' works:
$ dnf list --available --repo=copr:copr.fedorainfracloud.org:lizardbyte:beta Updating and loading repositories: Repositories loaded. Available packages Sunshine.src 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta Sunshine.x86_64 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta copr-ci.src 2025.526.2856-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta copr-ci.x86_64 2025.526.2856-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta
My conceptual problem is that this makes no logical sense. If I don't include '--available' than I get a long list of packages which are *not* from the repo I explicitly asked for. This violates the venerable Principle Of Least Astonishment.
poc
On Thu, 2025-06-05 at 12:03 +0100, Patrick O'Callaghan wrote:
On Wed, 2025-06-04 at 18:29 -0400, Todd Zullinger wrote:
I think that's because you need to add --available to the list subcommand to not include all the installed packages. Per dnf5-list(8):
--installed List only installed packages.
--available List only available packages.
Yes, adding '--available' works:
$ dnf list --available --repo=copr:copr.fedorainfracloud.org:lizardbyte:beta Updating and loading repositories: Repositories loaded. Available packages Sunshine.src 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta Sunshine.x86_64 2025.531.135549-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta copr-ci.src 2025.526.2856-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta copr-ci.x86_64 2025.526.2856-1.fc42 copr:copr.fedorainfracloud.org:lizardbyte:beta
My conceptual problem is that this makes no logical sense. If I don't include '--available' than I get a long list of packages which are *not* from the repo I explicitly asked for. This violates the venerable Principle Of Least Astonishment.
Not wishing to beat a dead horse, but in 'man dnf' we find:
--repo=REPO_ID,... Enable just specified repositories. This is a list option which can be specified multiple times. Accepted values are ids, or a glob of ids.
so I think my interpretation is correct and the actual behaviour is a bug. I'll consider filing it in BZ.
poc
On Thu, 2025-06-05 at 23:27 +0100, Patrick O'Callaghan wrote:
My conceptual problem is that this makes no logical sense. If I don't include '--available' than I get a long list of packages which are *not* from the repo I explicitly asked for. This violates the venerable Principle Of Least Astonishment.
Not wishing to beat a dead horse, but in 'man dnf' we find:
--repo=REPO_ID,... Enable just specified repositories. This is a list option which can be specified multiple times. Accepted values are ids, or a glob of ids.
so I think my interpretation is correct and the actual behaviour is a bug. I'll consider filing it in BZ.
https://bugzilla.redhat.com/show_bug.cgi?id=2370520
poc
Patrick O'Callaghan wrote:
On Thu, 2025-06-05 at 23:27 +0100, Patrick O'Callaghan wrote:
My conceptual problem is that this makes no logical sense. If I don't include '--available' than I get a long list of packages which are *not* from the repo I explicitly asked for. This violates the venerable Principle Of Least Astonishment.
Not wishing to beat a dead horse, but in 'man dnf' we find:
--repo=REPO_ID,... Enable just specified repositories. This is a list option which can be specified multiple times. Accepted values are ids, or a glob of ids.
so I think my interpretation is correct and the actual behaviour is a bug. I'll consider filing it in BZ.
I don't know that I agree or if it will be changed, but you can certainly argue it either way. :)
Essentially, the list command behaves as though '--installed --available' are passed if neither are given. Changing that now would change behavior that has been in place for many, many years.
In the early days of yum, there wasn't a way to filter the installed package set based on what repo it was installed from, as the information wasn't recorded. That has changed, of course. But I suspect that's at least partly the reason the list command behaves as it does.
Changing the behavior others have come to expect isn't a solid win all around. If it were being designed today, this would be a good opportunity to make that case, but I am not sure that changing it now is worth the friction it will cause.
If anything, maybe the documentation for the list command can be improved to make it clearer how things behave.
On Thu, 2025-06-05 at 19:48 -0400, Todd Zullinger wrote:
Patrick O'Callaghan wrote:
On Thu, 2025-06-05 at 23:27 +0100, Patrick O'Callaghan wrote:
My conceptual problem is that this makes no logical sense. If I don't include '--available' than I get a long list of packages which are *not* from the repo I explicitly asked for. This violates the venerable Principle Of Least Astonishment.
Not wishing to beat a dead horse, but in 'man dnf' we find:
--repo=REPO_ID,... Enable just specified repositories. This is a list option which can be specified multiple times. Accepted values are ids, or a glob of ids.
so I think my interpretation is correct and the actual behaviour is a bug. I'll consider filing it in BZ.
I don't know that I agree or if it will be changed, but you can certainly argue it either way. :)
Essentially, the list command behaves as though '--installed --available' are passed if neither are given.
Well, no. If "--available" is given explicitly, it *excludes* the installed packages except those from the specified repo. The behaviour is different if "--available" is omitted.
[...]
If anything, maybe the documentation for the list command can be improved to make it clearer how things behave.
That's probably the most sensible course.
poc
Patrick O'Callaghan wrote:
On Thu, 2025-06-05 at 19:48 -0400, Todd Zullinger wrote:
Essentially, the list command behaves as though '--installed --available' are passed if neither are given.
Well, no. If "--available" is given explicitly, it *excludes* the installed packages except those from the specified repo. The behaviour is different if "--available" is omitted.
I was speaking of 'dnf list' without any --repo option. When you run it without options, it shows you installed and available packages. But I didn't make that very clear.
The case could be made that --repo implies --available. That would probably work as people expect in most cases, but I could be wrong.
For --installed, there are a good number of ways that the dnf db lacks the the originating repo of a given pacakge.
(The switch from dnf4 to dnf5 results in all of the packages showing "unknown" until they've been later updated by dnf5. But any dnf or rpm install commands directly on rpm files will have a similar issue.)
Implying --installed would likely expose those and lead to more subtle surprises.
I don't know if such a change (implying --available when --repo is given, that is) would be confusingly different enough from dnf list without the --repo option or not.
It's possible that since --repo is new in dnf5 that the authors will see this as a simple bug and change it so that it does filter as you'd expect from reading the description of the option in dnf5-list(8). The baggage of how yum and dnf handled the list option previously might be avoided in this case, which could be nice.
It may also be worth mentioning that 'dnf repoquery' often ends up being the better tool for making these kinds of queries. It has more options to tune the bahvior, so its quite possible that many folks don't spend a lot of time thinking about how 'dnf list' has some "odd" behavior when it comes to repo filtering.
$ dnf -qq rq --repo=fedora | wc -l 76879
$ dnf -qq rq --repo=updates | wc -l 14373
$ dnf -qq rq --qf '%{repoid} %{full_nevra}\n' | grep -cw '^updates' 14373
The --queryformat (AKA --qf) option has a lot of useful options. There is also 'fedrq' which is a tool to query releases of Fedora, CentOS, RHEL, Rocky, Alma, and more.
That doesn't preclude improving 'dnf list' whether in behavior or documentation, of course. It merely offers a few other tools in the toolbox to arrive at a similar end state.
If anything, maybe the documentation for the list command can be improved to make it clearer how things behave.
That's probably the most sensible course.
The "funny" part would be if you tried to do that and then found a note in there already which does cover this. Then the problem becomes "how to better organize the large amount of documentation so that note is easier to find." :)
I haven't read over the dnf5 documentation from start to finish, so it's entirely possible I missed it. That's one of the problems with knowing a tool well enough to not need the documentation most of the time (or at least thinking I know it well enough). :/
Thanks,
On Fri, 2025-06-06 at 10:15 -0400, Todd Zullinger wrote:
If anything, maybe the documentation for the list command can be improved to make it clearer how things behave.
That's probably the most sensible course.
The "funny" part would be if you tried to do that and then found a note in there already which does cover this. Then the problem becomes "how to better organize the large amount of documentation so that note is easier to find." :)
Thanks for the detailed answer. I'll need time to process it. However I go back to my original point. I want to see what packages are in a specific repo. The "obvious" command is "dnf list --repo=<repo_id>", but that doesn't do it. No doubt there are deep reasons to justify what actually happens, but the practical upshot is that an apparently simple call to dnf doesn't work as expected.
poc