RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1767345 - gnome-software fails to download repodata when repo is configured with custom variable in /etc/dnf/vars (/etc/yum/vars/)
Summary: gnome-software fails to download repodata when repo is configured with custom...
Keywords:
Status: CLOSED DUPLICATE of bug 1756382
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.0
Hardware: Unspecified
OS: Linux
medium
unspecified
Target Milestone: rc
: ---
Assignee: Jaroslav Rohel
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-31 08:50 UTC by Denis Volkov
Modified: 2023-09-07 20:54 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-18 08:32:39 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Denis Volkov 2019-10-31 08:50:29 UTC
Description of problem: gnome-software  is unable to download data from repository when there is custom variable (from /etc/yum/vars or /etc/dnf/vars) used in repo url

Version-Release number of selected component (if applicable):
gnome-software-3.30.6-1.el8.x86_64

How reproducible:

Steps to Reproduce:
1. Configure custom dnf-variable:
echo 'x86_64' > /etc/dnf/vars/osarch
2. Use this variable in the repo-file:
...
baseurl = https://cdn.redhat.com/content/dist/rhel8/$releasever/$osarch/appstream/os
...
3. Launch gnome-software

Actual results:
gnome-software shows error:
08:46:14:0904 Gs  not handling error download-failed for action get-updates: cannot update repo 'rhel-8-for-x86_64-custom': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.redhat.com/content/dist/rhel8/8.0/$osarch/appstream/os/repodata/repomd.xml


Expected results:
gnome-software successfully downloads data

Please also note that gnome-software successfully interprets '$releasever' variable in the same URL

Comment 1 Martin Krajnak 2019-10-31 11:23:36 UTC
Hello Denis,

can you please confirm that the repositories and variables are working for you when you use them via either dnf, yum or pkcon ?
For example:

# dnf install <pkg>
# pkcon install <pkg>

does "# dnf update" show any errors for you ?

Thanks in advance.

Comment 2 Denis Volkov 2019-11-01 10:22:32 UTC
Hello

Sorry, for missing info - yes, dnf/yum works ok.

# dnf clean all
Updating Subscription Management repositories.
24 files removed
[root@test ~]# dnf check-update
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                                                                                           2.3 MB/s | 9.4 MB     00:04    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                                              2.7 MB/s | 8.1 MB     00:02    
Last metadata expiration check: 0:00:01 ago on Fri 01 Nov 2019 11:19:48 CET.
Security: kernel-core-4.18.0-80.11.2.el8_0.x86_64 is an installed security update
Security: kernel-core-4.18.0-80.1.2.el8_0.x86_64 is the currently running version

`dnf install` also installs packages without a problem.

Comment 3 Martin Krajnak 2019-11-01 11:50:17 UTC
OK, I couldn't reproduce yesterday, today I am getting the same error, adding my reproducer for convenience:

Packages:
gnome-software-3.30.6-2.el8.x86_64
dnf-4.2.7-6.el8.noarch

Reproducer:
1. Setup subscription
2. Replacing strings generated by subscription manager to use variables:

so I have for all urls, even the disabled:
baseurl = https://cdn.stage.redhat.com/content/beta/$releasever/$osarch/appstream/os

3. adding vars
[root@localhost ~]# echo 'x86_64' > /etc/dnf/vars/osarch
[root@localhost ~]# echo 'rhel8/8' > /etc/dnf/vars/releasever


4. Verifying repositories
[root@localhost ~]# dnf -y update 
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)                   1.0 MB/s |  10 MB     00:10    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)                      1.7 MB/s | 6.7 MB     00:03    
Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)                   5.8 kB/s | 4.2 kB     00:00    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)                      5.2 kB/s | 4.1 kB     00:00    
Dependencies resolved.
Nothing to do.
Complete!

5. forcing gnome-software to reload repos and running the instance
$ pkill gnome-software 
$ gnome-software --verbose
Stderr:
11:42:00:0380 Gs  hiding category games featured applications: found only 0 to show, need at least 9
11:42:04:0110 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:07:0985 Gs  not handling error download-failed for action get-updates: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:11:0842 Gs  hiding category productivity featured applications: found only 0 to show, need at least 9
11:42:11:0842 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:15:0787 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:24:0242 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:28:0107 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:32:0000 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml
11:42:36:0233 Gs  not handling error download-failed for action refine: failed to resolve package_ids: cannot update repo 'rhel-8-for-x86_64_appstream-beta-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 403 for https://cdn.stage.redhat.com/content/beta/8/$osarch/appstream/os/repodata/repomd.xml


Note: my $releasever is interpreted wrong:
should be:
[root@localhost ~]# cat /etc/dnf/vars/releasever 
rhel8/8

Comment 4 Denis Volkov 2019-11-01 18:26:50 UTC
Well, I think 'releasever' is interpreted wrong for you because it is internal yum/dnf variable. 

...
baseurl = https://cdn.redhat.com/content/dist/rhel8/$releasever/x86_64/appstream/os
...

And gnome-software handles '$releasever' here without a problem.


But then we add new custom variable - '$osarch' in my case:

...
#baseurl = https://cdn.redhat.com/content/dist/rhel8/$releasever/x86_64/appstream/os
baseurl = https://cdn.redhat.com/content/dist/rhel8/$releasever/$osarch/appstream/os
...

Gnome-software suddenly stops interpreting it. As you see, the only peace of url changed is the replacement of 'x86_64' to '$osarch'.

By the way, your inability to reproduce may be because gnome-software also has a cache. I got rid of it by wiping `/var/cache/PackageKit/8.0/`, though I guess there should be better ways to do it

Comment 5 Martin Krajnak 2019-11-04 11:07:15 UTC
(In reply to Denis Volkov from comment #4)
> Well, I think 'releasever' is interpreted wrong for you because it is
> internal yum/dnf variable. 
>

I didn't know that, thanks.

>
> By the way, your inability to reproduce may be because gnome-software also
> has a cache. I got rid of it by wiping `/var/cache/PackageKit/8.0/`, though
> I guess there should be better ways to do it

Yes, makes sense now.

Comment 6 Martin Krajnak 2019-11-04 12:26:28 UTC
I tried to do automated test case and I noticed the following:

1.install repos with variables
2.run dnf update
Result:
dnf update the repo by replacing the variables with actual strings in variables for me. 
and gnome-software works

So the bug here is that gnome-software should force the libdnf/dnf to update repo files
before reading them ?

Comment 7 Martin Krajnak 2019-11-04 13:33:28 UTC
(In reply to Martin Krajnak from comment #6)

> dnf update the repo by replacing the variables with actual strings in

This is very strange, dnf renames only repositories added by subscription manager for me.
When I use internal repository, gnome-software is interpreting the variable without problems
I even added one more custom variable $distro and in runs smoothly even after I wiped the cache.

So to update reproducer:

1. Setup subscription
2. Replacing strings generated by subscription manager to use variables:

repo:
baseurl = https://cdn.stage.redhat.com/content/beta/$releasever/$osarch/appstream/os

3. adding var
[root@localhost ~]# echo 'x86_64' > /etc/dnf/vars/osarch

4. remove cache, forcing gnome-software to reload repos and running the instance
# rm -rf /var/cache/PackageKit/*
$ rm -rf ~/.cache/gnome-software/*
$ pkill gnome-software 
$ gnome-software --verbose

Results: variables is not interpreted however:

# dnf update
dnf replaced variables with actual strings:
baseurl = https://cdn.stage.redhat.com/content/beta/rhel8/8/x86_64/appstream/os

$ pkill gnome-software 
$ gnome-software --verbose
there are no variables to interpret, so gnome-software works.


2. reproducer:
Setting up variables:
# echo 'x86_64' > /etc/dnf/vars/osarch
# echo 'rhel' > /etc/dnf/vars/distro

internal repo url:
baseurl = http://download.eng.brq.redhat.com/pub/$distro/nightly/latest-RHEL-8.*/compose/BaseOS/$osarch/os/

# rm -rf /var/cache/PackageKit/*
$ rm -rf ~/.cache/gnome-software/*

Result: variables are interpreted, metadata are fetched apps are rendered.

So this will be some weird stuff around PackageKit/dnf/gnome-software maybe even subscription manager going on.

Comment 8 Martin Krajnak 2019-11-04 14:00:10 UTC
(In reply to Martin Krajnak from comment #7)
> (In reply to Martin Krajnak from comment #6)
> 
> > dnf update the repo by replacing the variables with actual strings in
> 
> This is very strange, dnf renames only repositories added by subscription
> manager for me.
> When I use internal repository, gnome-software is interpreting the variable
> without problems
> I even added one more custom variable $distro and in runs smoothly even
> after I wiped the cache.

no, I made a mistake, repo was configured with skip_if_unavailable = 1, 
so there were no errors shown in stderr and I got fooled by gnome-software showing me only
packages that were already installed mistaking them for actual packages in the repo.

So it doesn't work, variable interpretation is broken.

Comment 9 Denis Volkov 2019-11-04 14:09:10 UTC
Same problem happens with pkcon:

# pkcon -c 1  get-updates
Getting updates               [=========================]         
Starting                      [=========================]         
Loading cache                 [=========================]         
Downloading repository information[=========================]         
Finished                      [=========================]         
Loading cache                 [=========================]         
Fatal error: cannot update repo 'BaseOS-nightly': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 404 for http://download.eng.brq.redhat.com/pub/rhel/nightly/latest-RHEL-8.*/compose/BaseOS/$osarch/os/repodata/repomd.xml


So it looks to me like the problem is in PackageKit.

Comment 10 Tomas Pelka 2019-11-04 15:57:19 UTC
So this seems like not a gnome-software specific issue, moving to dnf.

Comment 11 Jaroslav Rohel 2019-11-18 08:32:39 UTC
The bug is duplicate of another one (bug 1756382). I solved it few days ago.

*** This bug has been marked as a duplicate of bug 1756382 ***


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