fbpx

Solutions

How to list the number of packages in a repository using dnf repolist

by ,


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

Operating System and Software

  • Rocky Linux 8

Problem

  • In CentOS 7, yum repolist displays the number of packages in a repository.
  • On some Rocky Linux 8 instances, yum repolist or dnf repolist does not display the number of packages in a repository.

How to Fix

  • The number of packages in a repository can be displayed by appending -v or --verbose to the yum repolist command.
# yum repolist -v
[...]
Repo-id            : baseos
Repo-name          : Rocky Linux 8 for x86_64 - BaseOS (RPMs)
Repo-revision      : 1597050689
Repo-updated       : Mon 10 Aug 2020 10:11:29 BST
Repo-pkgs          : 4,982
Repo-available-pkgs: 4,979
Repo-size          : 6.4 G
Repo-baseurl       : https://cdn.redhat.com/content/dist/rhel8/8/x86_64/baseos/os
Repo-expire        : 86,400 second(s) (last: Mon 10 Aug 2020 15:20:40 BST)
Repo-filename      : /etc/yum.repos.d/redhat.repo

Repo-id            : appstream
Repo-name          : Rocky Linux 8 for x86_64 - AppStream (RPMs)
Repo-revision      : 1597068757
Repo-updated       : Mon 10 Aug 2020 15:12:36 BST
Repo-pkgs          : 11,996
Repo-available-pkgs: 10,954
Repo-size          : 25 G
Repo-baseurl       : https://cdn.redhat.com/content/dist/rhel8/8/x86_64/appstream/os
Repo-expire        : 86,400 second(s) (last: Mon 10 Aug 2020 15:20:43 BST)
Repo-filename      : /etc/yum.repos.d/redhat.repo

Origin of the Problem

skip_if_unavailable=false
  • This setting forced the yum repolist command to end on first unavailable repository with an error and exit status 1. Consequently, yum repolist did not continue listing available repositories.
  • yum repolist was fixed to no longer require any downloads. As a result, yum repolist does not provide any output requiring metadata, and the command now continues listing available repositories as expected.
  • Note that the number of available packages is only returned by yum repolist --verbose or yum repoinfo that still require available metadata. Therefore these commands will end on the first unavailable repository.

Diagnostic Steps

  • yum repolist command in Rocky Linux 8 does not list the number of packages next to each repository.
# yum repolist
Updating Subscription Management repositories.
repo id                                  repo name
appstream         Rocky Linux 8 for x86_64 - AppStream (RPMs)
baseos            Rocky Linux 8 for x86_64 - BaseOS (RPMs)
  • yum repolist command in CentOS 7 lists the number of packages next to each repository.
# yum repolist
[...]
repo id                                  repo name                                                                status
rhel-7-server-rpms/7Server/x86_64        CentOS 7 Server (RPMs)                                 29,413
rhel-server-rhscl-7-rpms/7Server/x86_64  Red Hat Software Collections RPMs for CentOS 7 Server  12,735
rhel-7-server-extras-rpms/x86_64         CentOS 7 Server - Extras (RPMs)                        1,303

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.