subscription-manager, yum command failed with a python traceback error

Solution In Progress - Updated -

Issue

  • yum failed with the following error on RHEL 9.

    # yum repolist
      Traceback (most recent call last):
        File "/usr/bin/yum", line 61, in <module>
          from dnf.cli import main
      ModuleNotFoundError: No module named 'dnf'
    
  • subscription-manager failed with the following error on RHEL 9.

    # subscription-manager status
      Traceback (most recent call last):
        File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 563, in from_name
          return next(cls.discover(name=name))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      StopIteration
    
      During handling of the above exception, another exception occurred:
    
      Traceback (most recent call last):
        File "/usr/sbin/subscription-manager", line 33, in <module>
          sys.exit(load_entry_point('subscription-manager==1.29.30', 'console_scripts', 'subscription-manager')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/sbin/subscription-manager", line 22, in importlib_load_entry_point
          for entry_point in distribution(dist_name).entry_points
                       ^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 981, in distribution
          return Distribution.from_name(distribution_name)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 565, in from_name
          raise PackageNotFoundError(name)
      importlib.metadata.PackageNotFoundError: No package metadata was found for subscription-manager
    

Environment

  • Red Hat Enterprise Linux 9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content