Failed to synchronize cache for repos for RHEL 8

Latest response

When I run dnf repolist on rhel 8 enabled machine I see the following error "Failed to synchronize cache for repo" as seen below:

dnf repolist

Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 649 B/s | 224 B 00:00
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 635 B/s | 224 B 00:00
Red Hat Enterprise Linux 8 for x86_64 - Supplementary (RPMs) 623 B/s | 224 B 00:00

Failed to synchronize cache for repo 'rhel-8-for-x86_64-appstream-rpms', ignoring this repo.
Failed to synchronize cache for repo 'rhel-8-for-x86_64-baseos-rpms', ignoring this repo.
Failed to synchronize cache for repo 'rhel-8-for-x86_64-supplementary-rpms', ignoring this repo.

Responses

Hi Harsha,

Please execute the following commands ... this should solve the problem. :)

sudo dnf clean all
sudo rm -r /var/cache/dnf
sudo dnf upgrade

Regards,
Christian

Hi Christian,

Thank you for the response. I have tried these commands before, I still have the same issues. I don't have any issues when I am using rhel 8 beta repos but with the usual rhel 8 repos, I see this issue.

Red Hat Enterprise Linux 8 for x86_64 - AppStre Red Hat Enterprise Linux 8 for x86_64 - BaseOS
Red Hat Enterprise Linux 8 for x86_64 - Supplem

I am on Red Hat Satellite 6.3.0. Please let me know if there are any other ways to solve this issue.

Looks like it was not issues with the dnf cache. I think I used 8.0 repos instead of 8 and refreshed manifest, it fixed the issue.

Hi Harsha,

Glad you could get it done ! :)

Regards,
Christian

sudo dnf rm -r /var/cache/dnf should be:

sudo rm -r /var/cache/dnf

Hi Karsten,

Why that ? It works perfectly fine without the force option. The force option should only be
used in rare cases when the remove command otherwise doesn't succeed. It is a dangerous
option which often causes users having a broken system afterwards when they accidentally
made a typo. I'm astonished to see, that a Red Hat employee provides it on the community
portal where many new and not so experienced users are around.

Regards,
Christian

Hi Christian,

thanks for the hint.

First: 'sudo dnf rm -r /var/cache/dnf' contains 'dnf' which is wrong.

Second (-f): Valid point. Preventing users from hitting [enter] after entering '/' could cause disasters. Just copied it from my terminal (repeating the confirmations in this case was quite tedious to me).

Changed my comment.

B.t.w. I could not use this article to solve my problem which is described here: https://access.redhat.com/solutions/4173841 => unfortunately, I couldn't get a valid CA for cdn.redhat.com...

Thank you Karsten, for pointing me to the mistake I made (I accidentally typed dnf, which of
course is wrong). I've corrected it at once to sudo rm -r /var/cache/dnf. Thanks again.
I am glad you agree with me regarding the force option. Now I wish you a great weekend ! :)

Regards,
Christian

Im getting this same problem and have tried clearing the cache as suggested but didnt fix. Running with -v switch gives the further error details of :

Cannot download 'https://cdn.redhat.com/content/dist/rhel8/8/x86_64/appstream/os': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried. Error: Failed to synchronize cache for repo 'rhel-8-for-x86_64-appstream-rpms'

System was updating fine until today and is a fresh install of RH and registered with developer subscription.

UPDATE - actually this turned out to be a DNS issue, for some reason my dns config had messed up, once fixed things worked again.