yum/dnf exits with "Error: Failed to synchronize cache for repo 'xxx'" without further details

Solution Verified - Updated -

Issue

  • Executing a yum or dnf command fails in error, as in the example below

    # dnf repolist
    [...]
    Error: Failed to synchronize cache for repo 'XXX'
    
  • Log file /var/log/dnf.log shows a Python backtrace

    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 566, in load
        ret = self._repo.load()
      File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 503, in load
        return _repo.Repo_load(self)
    RuntimeError: Failed to synchronize cache for repo 'XXX'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
        return _main(base, args, cli_class, option_parser_class)
      File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 99, in _main
        return cli_run(cli, base)
      File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 115, in cli_run
        cli.run()
      File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1124, in run
        self._process_demands()
      File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 828, in _process_demands
        load_available_repos=self.demands.available_repos)
      File "/usr/lib/python3.6/site-packages/dnf/base.py", line 400, in fill_sack
        self._add_repo_to_sack(r)
      File "/usr/lib/python3.6/site-packages/dnf/base.py", line 135, in _add_repo_to_sack
        repo.load()
      File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 568, in load
        raise dnf.exceptions.RepoError(str(e))
    dnf.exceptions.RepoError: Failed to synchronize cache for repo 'XXX'
    2019-05-24T09:45:02Z CRITICAL Error: Failed to synchronize cache for repo 'XXX'
    
  • yum/dnf commands are failing with error Peer certificate cannot be authenticated with given CA certificates:-

    # yum update
    Updating Subscription Management repositories.
    rhel-8-for-x86_64-appstream-rpms   0.0  B/s |   0  B     00:00
    Errors during downloading metadata for repository 'rhel-8-for-x86_64-appstream-rpms':
    
      - Curl error (60): Peer certificate cannot be authenticated with given CA certificates for https://cdn.redhat.com/content/dist/rhel8/8/x86_64/appstream/os/repodata/repomd.xml [SSL certificate problem: self signed certificate in certificate chain]
    
    Error: Failed to download metadata for repo 'rhel-8-for-x86_64-appstream-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
    

Environment

  • Red Hat Enterprise Linux
    • 8
    • 9
  • Red Hat Subscription Manager(RHSM)

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