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 1613456 - [RHEL76] It takes two invocations of "dnf-plugin-subscription-manager" to populate the redhat.repo file
Summary: [RHEL76] It takes two invocations of "dnf-plugin-subscription-manager" to pop...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.6
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 1558411 1615433
TreeView+ depends on / blocked
 
Reported: 2018-08-07 15:19 UTC by Rehana
Modified: 2018-10-30 10:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 10:37:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1609052 1 None None None 2021-01-20 06:05:38 UTC
Red Hat Product Errata RHBA-2018:3153 0 None None None 2018-10-30 10:38:05 UTC

Internal Links: 1609052

Description Rehana 2018-08-07 15:19:14 UTC
Description of problem:
Observed that redhat.repo file was populated after running dnf repolist -d3 twice on the system . 

Note: You need to follow the below workaround to load the plugins the repos ; separate Bug 1613454 was logged to track this 

# echo 'pluginpath=/usr/lib64/python2.7/site-packages/dnf-plugins,/usr/lib/python2.7/site-packages/dnf-plugins' >> /etc/dnf/dnf.conf
[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/dnf/dnf.conf 
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
pluginpath=/usr/lib64/python2.7/site-packages/dnf-plugins,/usr/lib/python2.7/site-packages/dnf-plugins


dnf-plugin-subscription-manager-1.21.5-7.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Since yum and dnf can co-exist on RHEL76 , make sure the all the yum plugins are disabled (to make sure the dnf is not using the file that are already populated by yum ) 

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# subscription-manager config --list | grep auto_enable
   auto_enable_yum_plugins = 0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/yum/pluginconf.d/search-disabled-repos.conf | grep enabled
enabled=0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/yum/pluginconf.d/subscription-manager.conf | grep enabled
enabled=0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/yum/pluginconf.d/product-id.conf | grep enabled
enabled=0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# subscription-manager unregister
This system is currently not registered.
[root@ibm-x3650m4-01-vm-12 pluginconf.d]# yum clean all 
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# dnf clean all
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
8 files removed


2. Now register and auto-attach the system 
# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel74
Password: 
The system has been registered with ID: 1f391b8f-c6d0-4f28-8598-5cd878b99595
The registered system name is: ibm-x3650m4-01-vm-12.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3) Delete the redhat.repo file ( only to be tried on rhel76, as the redhat.repo file is already populated by yum)

4) dnf replist -d3 
Observed the repos were not listed 

# dnf repolist -d3
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
DNF version: 2.7.5
cachedir: /var/cache/dnf
Updating Subscription Management repositories.
No repositories available

Trying again
# dnf repolist -d3
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
DNF version: 2.7.5
cachedir: /var/cache/dnf
Updating Subscription Management repositories.
Last metadata expiration check: 0:07:16 ago on Tuesday 07 August 2018 11:04:38 AM EDT.
repo id                                                                                    repo name                                                                                                         status
rhel-7-server-rpms                                          

Actual results:
Repos are now listed after second attempt

Expected results:
repos should be listed immediatly 


Additional info:

Comment 2 Chris Snyder 2018-08-09 14:20:50 UTC
@dev All we should need is a cherry pick of a3bd8ae27acd287c83c811a2e18da79629946bb0

Comment 3 Chris Snyder 2018-08-09 21:03:47 UTC
Correction the commit hash is: 4cee072dddd2df09b1d4076e978cba8cea2b2154

Comment 4 Chris Snyder 2018-08-16 18:09:44 UTC
The fix has been cherry-picked for the next build. Moving to POST.

Comment 6 Rehana 2018-08-20 10:14:40 UTC
Reproducer :
===========

# rpm -qa subsc* dnf* | sort
dnf-2.7.5-17.el7.noarch
dnf-data-2.7.5-17.el7.noarch
dnf-plugins-core-2.1.5-5.el7.noarch
dnf-plugin-subscription-manager-1.21.5-7.el7.x86_64
subscription-manager-1.21.5-7.el7.x86_64
subscription-manager-rhsm-1.21.5-7.el7.x86_64
subscription-manager-rhsm-certificates-1.21.5-7.el7.x86_64

1.Disable all yum plugins 

#subscription-manager config --list | grep auto_enable
   auto_enable_yum_plugins = 0

# cat /etc/yum/pluginconf.d/search-disabled-repos.conf | grep enabled
enabled=0
# Repositories matching the patterns listed in ignored_repos will not be
enabled by the plugin

# cat /etc/yum/pluginconf.d/subscription-manager.conf | grep enabled
enabled=0

# cat /etc/yum/pluginconf.d/product-id.conf | grep enabled
enabled=0

2. Register and attach subscription

# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel74
Password: 
The system has been registered with ID: a2e95a09-359a-4b2b-a854-f656da1c9106
The registered system name is: ibm-x3650m4-01-vm-14.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3.Delete the redhat.repo populated 

# rm -rf /etc/yum.repos.d/redhat.repo

4.Execute dnf repolist

# dnf repolist -d3 
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install,
download, generate_completion_cache, needs-restarting, playground, repoclosure,
repograph, repomanage, reposync
DNF version: 2.7.5
cachedir: /var/cache/dnf
No repositories available

5. Add a workaround to load the plugins.

#echo 'pluginpath=/usr/lib64/python2.7/site-packages/dnf-plugins,/usr/lib/python2.7/site-packages/dnf-plugins' >> /etc/dnf/dnf.conf

6. # dnf repolist -d3 
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
DNF version: 2.7.5
cachedir: /var/cache/dnf
Updating Subscription Management repositories.
No repositories available

NO repositories were loaded

Try again

# dnf repolist -d3 
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
DNF version: 2.7.5
cachedir: /var/cache/dnf
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:30 ago on Monday 20 August 2018 06:13:13 AM EDT.
repo id                                                                                    repo name                                                                                                         status
rhel-7-server-rpms                                                                         Red Hat Enterprise Linux 7 Server (RPMs)                                                                          20,891

On the second attempt the repositories were listed.

Comment 7 Rehana 2018-08-20 10:19:28 UTC
Verifying on :
===============
# rpm -qa subsc* dnf* | sort
dnf-2.7.5-17.el7.noarch
dnf-data-2.7.5-17.el7.noarch
dnf-plugins-core-2.1.5-5.el7.noarch
dnf-plugin-subscription-manager-1.21.7-1.el7.x86_64
subscription-manager-1.21.7-1.el7.x86_64
subscription-manager-rhsm-1.21.7-1.el7.x86_64
subscription-manager-rhsm-certificates-1.21.7-1.el7.x86_64

Note:Install dnf-plugin-subscription manager and its dependencies from Extras
repo.

1. Make sure all the yum plugin are disabled on the system 

# subscription-manager config --list | grep auto_enable
   auto_enable_yum_plugins = 0

# cat /etc/yum/pluginconf.d/search-disabled-repos.conf | grep enabled
enabled=0
# Repositories matching the patterns listed in ignored_repos will not be
enabled by the plugin

# cat /etc/yum/pluginconf.d/subscription-manager.conf | grep enabled
enabled=0

#  cat /etc/yum/pluginconf.d/product-id.conf | grep enabled
enabled=0

2. Register and attach subscription

# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel74
Password: 
The system has been registered with ID: 2dd800bd-4346-4cff-83d4-9714618696b6
The registered system name is: cisco-b22m3-01.rhts.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3.Remove the redhat.repo file from the system 

# rm -rf redhat.repo

4.Execute dnf repolist -d3 ( note : Now that Bug 1613454 is fixed and verified, user need NOT to add the plugin path into dnf.conf file manually ) 

# dnf repolist -d3
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
Updating Subscription Management repositories.
DNF version: 2.7.5
cachedir: /var/cache/dnf
Updating Subscription Management repositories.
Last metadata expiration check: 0:39:59 ago on Monday 20 August 2018 05:38:04 AM EDT.
repo id                                                                                    repo name                                                                                                         status
rhel-7-server-rpms                                                                         Red Hat Enterprise Linux 7 Server (RPMs)                                                                          20,891

Plugins are now loaded and repos are listed successfully in the first attempt itself. 

Based on the above observations marking the bug as Verified.

Comment 9 errata-xmlrpc 2018-10-30 10:37:37 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-2018:3153


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