DNF list command

Issues related to applications and software problems and general support
Post Reply
gerry666uk
Posts: 98
Joined: 2020/02/10 19:06:06

DNF list command

Post by gerry666uk » 2021/10/02 13:48:53

CentOS 8.4
Run commands

Code: Select all

dnf repolist extras
repo id                       repo name                                      status
extras                        CentOS Linux 8 - Extras                        enabled
the repo is enabled

Code: Select all

dnf --repo "extras" list | more
I expect to see ONLY packages that exist in "extras", but instead I see a huge list of installed packages (from other repos) before the "extras" list.
I then want to only see installed packages from "extras", but again I get a huge list of installed packages.

Code: Select all

dnf --repo "extras" list installed
If I try to use "epel" instead of "extras", I get the same issue
This command works, shows only packages that exist in "extras"

Code: Select all

dnf --repo "extras" repoquery
But this does not work (empty list)

Code: Select all

dnf --repo "extras" repoquery --installed
I'm fairly sure this was working in the past.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: DNF list command

Post by TrevorH » 2021/10/02 18:07:32

dnf list installed or dnf list available? Also --disablerepo=\* might help.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

gerry666uk
Posts: 98
Joined: 2020/02/10 19:06:06

Re: DNF list command

Post by gerry666uk » 2021/10/02 21:25:10

I tried this:

Code: Select all

dnf --disablerepo "*" list installed
and still get a long list of installed packages
it could be related to repo names being changed around CentOS 8.3
The installed software is showing repo names starting with an @ sign

Code: Select all

zlib-devel.x86_64                  1.2.11-17.el8                          @baseos   
zsh.x86_64                         5.5.1-6.el8_1.2                        @BaseOS   
zstd.x86_64                        1.4.4-1.el8                            @AppStream
Here, 'baseos' is the new name, 'BaseOS' and 'AppStream' are the old mixed case names.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: DNF list command

Post by TrevorH » 2021/10/02 22:29:56

dnf --disablerepo "*" list installed
Which lists installed packages that match your pattern "*" i.e. all of them. There is no mechanism to list installed packages from a particular repo if that's what you're attempting to do? To do that you can use a utility called 'keychecker' or you could if anyone had branched it in EPEL for el8. So the next best way to separate out what came from what repo once it's installed is to just grep the dnf list installed output.

The other one to do is dnf list available --repo=extras which shows you all the packages from just the extras repo that are not installed and are thus available to install.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: DNF list command

Post by jlehtone » 2021/10/03 09:10:11

Like Trevor said, 'grep' is quite nice (and piping simple commands into workflow is "unix-style"):

Code: Select all

dnf list installed | grep @extras
Furthermore, grep -i @baseos is case-insensitive match.

Post Reply