Bug 1787637 - Error: Failed to synchronize cache for repo
Summary: Error: Failed to synchronize cache for repo
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: yum
Version: 8.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: 8.0
Assignee: amatej
QA Contact: Eva Mrakova
URL:
Whiteboard:
Depends On:
Blocks: 1790400
TreeView+ depends on / blocked
 
Reported: 2020-01-03 18:47 UTC by Rakesh
Modified: 2020-04-28 16:49 UTC (History)
6 users (show)

Fixed In Version: dnf-4.2.17-6.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1790400 (view as bug list)
Environment:
Last Closed: 2020-04-28 16:49:13 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)
dnf.log (114.74 KB, text/plain)
2020-01-06 10:24 UTC, LiliDeng
no flags Details
dnf.log (130.22 KB, text/plain)
2020-01-06 10:31 UTC, LiliDeng
no flags Details
repo file (6.01 KB, text/plain)
2020-01-06 10:31 UTC, LiliDeng
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1823 None None None 2020-04-28 16:49:22 UTC

Description Rakesh 2020-01-03 18:47:31 UTC
Description of problem:

On Azure RHEL 8 test server, if I install “rpm-build” package first and then try to install “make” package then below issue is reproduced.
 
yum install make --verbose
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, uploadprofile
DNF version: 4.0.9
cachedir: /var/cache/dnf
repo: downloading from remote: rhui-codeready-builder-for-rhel-8-x86_64-rhui-rpms
Red Hat CodeReady Linux Builder for RHEL 8 x86_  89  B/s | 284  B     00:03
Cannot download 'https://rhui-1.microsoft.com/pulp/repos/content/dist/rhel8/rhui/8.0/x86_64/codeready-builder/os, https://rhui-2.microsoft.com/pulp/repos/content/dist/rhel8/rhui/8.0/x86_64/codeready-builder/os, https://rhui-3.microsoft.com/pulp/repos/content/dist/rhel8/rhui/8.0/x86_64/codeready-builder/os': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
Error: Failed to synchronize cache for repo 'rhui-codeready-builder-for-rhel-8-x86_64-rhui-rpms'


Version-Release number of selected component (if applicable):
cat /etc/redhat-release
Red Hat Enterprise Linux release 8.0 (Ootpa)

How reproducible:

Steps to Reproduce:
1. Deploy RHEL 8 VM in Microsoft Azure
2. yum install rpm-build 
3. yum install make

Actual results:

Red Hat CodeReady Linux Builder for RHEL 8 x86_  89  B/s | 284  B     00:03
Cannot download 'https://rhui-1.microsoft.com/pulp/repos/content/dist/rhel8/rhui/8.0/x86_64/codeready-builder/os, https://rhui-2.microsoft.com/pulp/repos/content/dist/rhel8/rhui/8.0/x86_64/codeready-builder/os, https://rhui-3.microsoft.com/pulp/repos/content/dist/rhel8/rhui/8.0/x86_64/codeready-builder/os': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
Error: Failed to synchronize cache for repo 'rhui-codeready-builder-for-rhel-8-x86_64-rhui-rpms'

Expected results:
"make" package installation to succeed.

Additional info:

Comment 1 Ju Lee 2020-01-03 18:58:34 UTC
This issue blocks the most of Microsoft Linux test automation run-time with RHEL 8.x. Many places use 'yum install rpm-build'

Comment 2 Radek Bíba 2020-01-06 09:07:42 UTC
Could you please copy&paste relevant lines from /var/log/dnf.log? Also, I wonder if "8.0" is the correct release version in the path. Would you mind doing:

1) check if /etc/yum/vars/releasever exists
1.1) if so, what's inside?
1.2) else:
1.2.1) echo 8 > /etc/yum/vars/releasever
1.2.2) run "yum install..." again and see what happens.
1.2.3) restore/delete /etc/yum/vars/releasever

Please also share what's in the yum repository file that defines the CodeReady repository.

Comment 3 LiliDeng 2020-01-06 10:24:08 UTC
Created attachment 1650079 [details]
dnf.log

Comment 4 LiliDeng 2020-01-06 10:30:23 UTC
(In reply to Radek Bíba from comment #2)
> Could you please copy&paste relevant lines from /var/log/dnf.log? Also, I
> wonder if "8.0" is the correct release version in the path. Would you mind
> doing:
> 
> 1) check if /etc/yum/vars/releasever exists
> 1.1) if so, what's inside?
> 1.2) else:
> 1.2.1) echo 8 > /etc/yum/vars/releasever
> 1.2.2) run "yum install..." again and see what happens.
> 1.2.3) restore/delete /etc/yum/vars/releasever
> 
> Please also share what's in the yum repository file that defines the
> CodeReady repository.

Thanks Radek, attached dnf.log, 8 is expected, but 8.0 is not, after install rpm-build, the version changed from 8 => 8.0.
1.2) /etc/yum/vars/releasever not exists.
1.2.1) echo 8 > /etc/yum/vars/releasever is a work around.
1.2.2) yum install works
1.2.3) remove /etc/yum/vars/releasever => issue happen again, restore => issue resolved

Attached the only repo file, if the version is 8, the URL is valid.

Comment 5 LiliDeng 2020-01-06 10:31:29 UTC
Created attachment 1650080 [details]
dnf.log

Comment 6 LiliDeng 2020-01-06 10:31:50 UTC
Created attachment 1650081 [details]
repo file

Comment 7 Radek Bíba 2020-01-06 12:04:18 UTC
Thank you. So it's a problem with the way the $releasever variable, which is used in the paths in the repo file, gets resolved. Interestingly, it really only happens after updating some package as part of the rpm-build installation.

This is what happens on a clean RHEL 8.0 system (in AWS, but I'm pretty sure Azure gives the same results):

# /usr/libexec/platform-python -c "import dnf; yb = dnf.Base(); print(yb.conf.releasever)"
8

Then:

Installing:
 rpm-build                                           x86_64                          4.14.2-25.el8                             rhui-rhel-8-appstream-rhui-rpms                          169 k
Upgrading:
 rpm-libs                                            x86_64                          4.14.2-25.el8                             rhui-rhel-8-baseos-rhui-rpms                             336 k
 rpm-plugin-systemd-inhibit                          x86_64                          4.14.2-25.el8                             rhui-rhel-8-baseos-rhui-rpms                              74 k
 rpm                                                 x86_64                          4.14.2-25.el8                             rhui-rhel-8-baseos-rhui-rpms                             539 k
 rpm-plugin-selinux                                  x86_64                          4.14.2-25.el8                             rhui-rhel-8-baseos-rhui-rpms                              73 k
 python3-rpm                                         x86_64                          4.14.2-25.el8                             rhui-rhel-8-baseos-rhui-rpms                             156 k
 rpm-build-libs                                      x86_64                          4.14.2-25.el8                             rhui-rhel-8-baseos-rhui-rpms                             152 k

# /usr/libexec/platform-python -c "import dnf; yb = dnf.Base(); print(yb.conf.releasever)"
8.0

Would it be acceptable for you to update dnf and its dependencies before installing the make package? (You *should* then be getting 8 as the releasever.)

Comment 8 Daniel Mach 2020-01-06 12:48:01 UTC
It seems you're running dnf-4.0.9 which was part of RHEL 8.0 - and that's pretty old and we have fixed many bugs since then.

Could you upgrade dnf, libdnf and rpm to be in higher or equal versions to following?
dnf-4.2.7-6.el8
libdnf-0.35.1-8.el8
rpm-4.14.2-25.el8


I think it may have something to do with following change in RPM:
* Wed Mar 06 2019 Panu Matilainen <pmatilai@redhat.com> - 4.14.2-10
- Return all string data as surrogate-escaped utf-8 in Python 3 (#1631292)

You either need to use both dnf and rpm in old versions or new versions.
The combination of old and new unfortunately doesn't work.

Comment 9 Rakesh 2020-01-06 20:28:40 UTC
Upgrading dnf & libdnf package mitigates the issue.

/usr/libexec/platform-python -c "import dnf; yb = dnf.Base(); print(yb.conf.releasever)"
8

rpm -qa | grep dnf
dnf-4.0.9.2-5.el8.noarch
libdnf-0.22.5-5.el8_0.x86_64


yum update dnf

rpm -qa | grep dnf
libdnf-0.35.1-9.el8_1.x86_64
dnf-4.2.7-7.el8_1.noarch

/usr/libexec/platform-python -c "import dnf; yb = dnf.Base(); print(yb.conf.releasever)"
8

Comment 10 Ju Lee 2020-01-07 19:55:01 UTC
Verified and confirmed 'yum update dnf rpm' prior to 'yum install rpm-build' is the only workaround to sustain 'yum repolist'.

Comment 11 Daniel Mach 2020-01-08 14:29:52 UTC
We should probably add a safeguard to force upgrading the packages together:

rpm.spec / python3-rpm :
Conflicts: python3-dnf < dnf-4.2.17-3

dnf.spec / python3-dnf :
Requires: python3-rpm >= 4.14.2-35


Acceptance Criteria: verify that if one package is upgraded, the other gets upgraded too (and vice versa)
No automated test is required.


Setting high priority because it might have impact of end users if they update packages separately.

Comment 14 amatej 2020-01-17 08:26:10 UTC
I created a PR that increases the required version of python3-rpm for dnf: https://github.com/rpm-software-management/dnf/pull/1577

Comment 20 errata-xmlrpc 2020-04-28 16:49:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1823


Note You need to log in before you can comment on or make changes to this bug.