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 2073551 - subscription-manager release setting is not landing in the redhat.repo file
Summary: subscription-manager release setting is not landing in the redhat.repo file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: subscription-manager
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: rc
: 9.0
Assignee: Pino Toscano
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 2074110
TreeView+ depends on / blocked
 
Reported: 2022-04-08 19:12 UTC by John Sefler
Modified: 2022-10-05 09:35 UTC (History)
6 users (show)

Fixed In Version: subscription-manager-1.29.26-3.el9_0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2074110 (view as bug list)
Environment:
Last Closed: 2022-05-17 15:58:31 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 3029 0 None Merged [1.29.26] 2073551: clear the release cache on release change 2022-04-13 14:40:19 UTC
Red Hat Issue Tracker RHELPLAN-118439 0 None None None 2022-04-08 19:18:45 UTC
Red Hat Product Errata RHBA-2022:3984 0 None None None 2022-05-17 15:58:45 UTC

Description John Sefler 2022-04-08 19:12:57 UTC
Description of problem:
On an RC compose of RHEL9 with a GA product subscription attached, subscription-manager release --list correctly reports the available listing file.  However, when using subscription-manager --set to pin the release repo paths to a specific cdn path, the "$releasever" variable in the repo paths is NOT getting replaced by the release setting.  This is a regression from RHEL8 GA behavior.


Version-Release number of selected component (if applicable):
[root@kvm-04-guest22 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.22-1
subscription management rules: 5.41
subscription-manager: 1.29.26-2.el9_0


How reproducible:


Steps to Reproduce:
Register a RHEL9 RC compose and auto-attach a RHEL subscription (not shown) then...
[root@kvm-04-guest22 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64
Product ID:     479
Version:        9.0
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         07/26/2021
Ends:           04/15/2022

[root@kvm-04-guest22 ~]# subscription-manager release --list
+-------------------------------------------+
          Available Releases       
+-------------------------------------------+
9
9.0

[root@kvm-04-guest22 ~]# subscription-manager release --set=9.0
Release set to: 9.0

[root@kvm-04-guest22 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24      <======= FAILED: Expected zero

[root@kvm-04-guest22 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/codeready-builder/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/baseos/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/codeready-builder/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/appstream/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/codeready-builder/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/appstream/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/baseos/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/baseos/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/baseos/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/codeready-builder/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/supplementary/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/appstream/source/SRPMS
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/appstream/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/supplementary/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/baseos/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/baseos/source/SRPMS
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/supplementary/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/supplementary/source/SRPMS
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/appstream/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/codeready-builder/source/SRPMS
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/supplementary/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/codeready-builder/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/$releasever/x86_64/supplementary/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/$releasever/x86_64/appstream/source/SRPMS
                                                   ^^^^^^^^^^^
                                                   ^^^^^^^^^^^
                                                   ^^^^^^^^^^^
                                                   ^^^^^^^^^^^
FAILED: Expected all of the $releasever variables in the paths above to be substituted with the "9.0" value that I set using "subscription-manager --set=9.0"


Actual results:
  above

Expected results:
  all occurrences of $releasever in /etc/yum.repos.d/redhat.repo should be substituted with the set release value.




Additional info:

Notice that this cache file appears to be stale and once removed, the $releasever variable is substituted....

[root@kvm-04-guest22 ~]# cat /var/lib/rhsm/cache/releasever.json
{"releaseVer": null}     <===== FAILED: Should not be null after I set a release value

[root@kvm-04-guest22 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24

[root@kvm-04-guest22 ~]# rm -f /var/lib/rhsm/cache/releasever.json

[root@kvm-04-guest22 ~]# subscription-manager release --set=9.0
Release set to: 9.0

[root@kvm-04-guest22 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
0

[root@kvm-04-guest22 ~]# subscription-manager release --unset
Release preference has been unset

[root@kvm-04-guest22 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
0

[root@kvm-04-guest22 ~]# rm -f /var/lib/rhsm/cache/releasever.json

[root@kvm-04-guest22 ~]# subscription-manager release --unset
Release preference has been unset

[root@kvm-04-guest22 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24

The addtional info above shows that the cache file /var/lib/rhsm/cache/releasever.json is not being updated to reflect the release setting/unsetting thereby failing to update the redhat.repo paths.

Comment 5 John Sefler 2022-04-13 18:19:28 UTC
Pre-verification testing of build...

[root@kvm-06-guest40 ~]# rpm -q subscription-manager
subscription-manager-1.29.26-3.el9_0.x86_64
[root@kvm-06-guest40 ~]# rpm -q subscription-manager --changelog | grep 2073551 -B10
* Wed Apr 13 2022 Christopher Snyder <csnyder> 1.29.26-3
- refresh: clear also the release status (ptoscano)
- 2073551: clear the release cache on release change (ptoscano)

[root@kvm-06-guest40 ~]# subscription-manager register --auto-attach --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_rhsmqe_testuser01
Password: 
The system has been registered with ID: 56097ef7-1801-4ed5-897a-4d81a68c5cc1
The registered system name is: kvm-06-guest40.hv2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed

[root@kvm-06-guest40 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24      <===== 24 OF THE ENTITLED REPO PATHS USE A $releasever VARIABLE

[root@kvm-06-guest40 ~]# subscription-manager release --list
+-------------------------------------------+
          Available Releases       
+-------------------------------------------+
9
9.0

[root@kvm-06-guest40 ~]# subscription-manager release --set 9
Release set to: 9

[root@kvm-06-guest40 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
0       <===== PASSED: THE $relasever VARIABLE HAS BEEN SUBSTITUTED

[root@kvm-06-guest40 ~]# subscription-manager release  --unset
Release preference has been unset

[root@kvm-06-guest40 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24      <===== PASSED: THE $relasever VARIABLE HAS BEEN RESTORED AFTER RELEASE IS UNSET

[root@kvm-06-guest40 ~]# subscription-manager release --set 9.0
Release set to: 9.0

[root@kvm-06-guest40 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
0       <===== PASSED: THE $relasever VARIABLE HAS BEEN SUBSTITUTED AGAIN

[root@kvm-06-guest40 ~]# subscription-manager release --set 8.3
No releases match '8.3'.  Consult 'release --list' for a full listing.

[root@kvm-06-guest40 ~]# egrep '$releasever|9\.0' /etc/yum.repos.d/redhat.repo
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/appstream/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/baseos/source/SRPMS
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/appstream/source/SRPMS
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/baseos/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/baseos/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/supplementary/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/baseos/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/codeready-builder/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/appstream/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/baseos/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/supplementary/os
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/supplementary/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/baseos/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/appstream/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/supplementary/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/codeready-builder/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/codeready-builder/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/appstream/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/codeready-builder/debug
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/codeready-builder/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/codeready-builder/os
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.0/x86_64/supplementary/debug
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/appstream/source/SRPMS
baseurl = https://cdn.redhat.com/content/dist/rhel9/9.0/x86_64/supplementary/source/SRPMS
                                                    ^^^
                                                    ^^^
                                                    ^^^
                                                    ^^^
PASSED: All 24 REPO PATHS WITH $releasever HAVE BEEN SUBSTITUTED WITH THE MOST RECENTLY SET RELEASE VALUE



Additional pre-verification for the refresh command...
[root@kvm-06-guest40 ~]# cat /var/lib/rhsm/cache/releasever.json
{"releaseVer": "9.0"}

[root@kvm-06-guest40 ~]# subscription-manager refresh
All local data refreshed

[root@kvm-06-guest40 ~]# cat /var/lib/rhsm/cache/releasever.json
cat: /var/lib/rhsm/cache/releasever.json: No such file or directory

[root@kvm-06-guest40 ~]# yum repolist --disablerepo=beaker*
Updating Subscription Management repositories.
repo id                                                        repo name
rhel-9-for-x86_64-appstream-rpms                               Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
rhel-9-for-x86_64-baseos-rpms                                  Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)

[root@kvm-06-guest40 ~]# cat /var/lib/rhsm/cache/releasever.json
{"releaseVer": "9.0"}

PASSED: THE REFRESH COMMAND CLEARS THE CACHED releasever AND SUBSEQUENT CALLS TO YUM RE-CASHED THE PREVIOUSLY SET RELEASE 



Verified:Tested against fixed in version subscription-manager-1.29.26-3.el9_0

Comment 8 John Sefler 2022-04-14 19:49:19 UTC
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
                 This System is reserved by jsefler.

      Beaker Test information:
                         HOSTNAME=kvm-07-guest35.hv2.lab.eng.bos.redhat.com
                            JOBID=6510027
                         RECIPEID=11797274
                    RESULT_SERVER=
                           DISTRO=RHEL-9.0.0-20220414.2
                     ARCHITECTURE=x86_64

**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
[root@kvm-07-guest35 ~]# rpm -q subscription-manager
subscription-manager-1.29.26-3.el9_0.x86_64
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# rpm -q subscription-manager --changelog | grep 2073551 -B10
* Wed Apr 13 2022 Christopher Snyder <csnyder> 1.29.26-3
- refresh: clear also the release status (ptoscano)
- 2073551: clear the release cache on release change (ptoscano)
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# subscription-manager release --list
+-------------------------------------------+
          Available Releases       
+-------------------------------------------+
9
9.0
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# subscription-manager release --set=9.0
Release set to: 9.0
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
0
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# subscription-manager release --unset
Release preference has been unset
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
24
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# cat /var/lib/rhsm/cache/releasever.json 
{"releaseVer": ""}
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# subscription-manager refresh
All local data refreshed
[root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# cat /var/lib/rhsm/cache/releasever.json 
cat: /var/lib/rhsm/cache/releasever.json: No such file or directory
[root@kvm-07-guest35 ~]# 


VERIFIED: nightly compose RHEL-9.0.0-20220414.2 includes subscription-manager-1.29.26-3.el9_0 which includes the fix for bug 2073551 as demonstrated above and comment 5

Comment 9 John Sefler 2022-04-14 20:04:31 UTC
(In reply to John Sefler from comment #8)
I accidentally excluded the registration step.  Inserting it below...

> **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
>                  This System is reserved by jsefler.
> 
>       Beaker Test information:
>                          HOSTNAME=kvm-07-guest35.hv2.lab.eng.bos.redhat.com
>                             JOBID=6510027
>                          RECIPEID=11797274
>                     RESULT_SERVER=
>                            DISTRO=RHEL-9.0.0-20220414.2
>                      ARCHITECTURE=x86_64
> 
> **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
> [root@kvm-07-guest35 ~]# rpm -q subscription-manager
> subscription-manager-1.29.26-3.el9_0.x86_64
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# rpm -q subscription-manager --changelog | grep
> 2073551 -B10
> * Wed Apr 13 2022 Christopher Snyder <csnyder> 1.29.26-3
> - refresh: clear also the release status (ptoscano)
> - 2073551: clear the release cache on release change (ptoscano)
> [root@kvm-07-guest35 ~]# 
[root@kvm-07-guest35 ~]# subscription-manager register --auto-attach --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_rhsmqe_testuser01
Password: 
The system has been registered with ID: 20476c8e-7371-4d8b-abf4-f05ea8fdfbea
The registered system name is: kvm-07-guest35.hv2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed

> [root@kvm-07-guest35 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
> 24
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# subscription-manager release --list
> +-------------------------------------------+
>           Available Releases       
> +-------------------------------------------+
> 9
> 9.0
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# subscription-manager release --set=9.0
> Release set to: 9.0
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
> 0
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# subscription-manager release --unset
> Release preference has been unset
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
> 24
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# cat /var/lib/rhsm/cache/releasever.json 
> {"releaseVer": ""}
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# subscription-manager refresh
> All local data refreshed
> [root@kvm-07-guest35 ~]# 
> [root@kvm-07-guest35 ~]# cat /var/lib/rhsm/cache/releasever.json 
> cat: /var/lib/rhsm/cache/releasever.json: No such file or directory
> [root@kvm-07-guest35 ~]# 
> 
> 
> VERIFIED: nightly compose RHEL-9.0.0-20220414.2 includes subscription-manager-1.29.26-3.el9_0 which includes the fix for bug 2073551 as demonstrated above and comment 5

Comment 11 errata-xmlrpc 2022-05-17 15:58:31 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 (new packages: subscription-manager), 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-2022:3984


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