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 797243 - manual changes to redhat.repo are too sticky
Summary: manual changes to redhat.repo are too sticky
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Adrian Likins
QA Contact: Entitlement Bugs
URL:
Whiteboard:
Depends On:
Blocks: 738066
TreeView+ depends on / blocked
 
Reported: 2012-02-24 16:41 UTC by John Sefler
Modified: 2013-10-04 20:28 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 13:06:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0804 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2012-06-19 19:51:31 UTC

Description John Sefler 2012-02-24 16:41:33 UTC
Description of problem:
Yes, manual changes to the /etc/yum.repos.d/redhat.repo should persist, but not after a user has unsubscribed or unregistered or re-registered.

In the scenario demonstrated below...
1. user registers
2. subscribes to a pool
3. edits the enabled flag of a newly granted repo in the redhat.repo file
4. observes in that the manual edit is indeed reflected in subscription-manager repos --list
5. observes in that the manual edit is indeed reflected in yum repolist enabled
6. unsubscribes from all entitlements
7. unregisters
8. observes subscription-manager repos --list is now empty
9. DOES NOT TRIGGER A YUM TRANSACTION, BUT NOTICES THE redhat.repo IS DIRTY
10. registers again
11. subscribes to same pool in step 2
12. runs subscription-manager repos --list
    BANG! The repos list still reflects the manual edit from step 4 (which should have been obliterated by the unsubscribe in step 6 as well as the unregister in step 7 as well as the new register in step 10.

The fundamental problem is that the contents of /etc/yum.repos.d/redhat.repo were never wiped clean by a yum transaction between step 6 thru 10.



Version-Release number of selected component (if applicable):
[root@jsefler-r63-server ~]# rpm -q subscription-manager
subscription-manager-0.99.8-1.git.13.1ecb596.el6.x86_64
[root@jsefler-r63-server ~]# rpm -q python-rhsm
python-rhsm-0.99.4-1.git.0.893878e.el6.noarch

How reproducible:


Steps to Reproduce:

NOTICE THAT MY certFrequency=240 IS HIGH SO THAT AN AUTOMATIC REFRESH WILL NOT AFFECT THIS TEST...
[root@jsefler-r63-server ~]# grep -i frequency /etc/rhsm/rhsm.conf
# Frequency of certificate refresh (in minutes):
certFrequency=240
# Frequency of autoheal check (1440 min = 1 day):
healFrequency = 1440


STEP 1...
[root@jsefler-r63-server ~]# subscription-manager register --username testuser1 --password password --org admin --force
The system with UUID 8796fb1f-0a18-4b7c-8591-728a38bad5a6 has been unregistered
The system has been registered with id: a47f33b3-9dde-4cde-83f1-438d0b5cb7fb 
[root@jsefler-r63-server ~]# subscription-manager repos --list
The system is not entitled to use any repositories.
[root@jsefler-r63-server ~]# yum repolist enabled
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
There was an error parsing the RHN proxy settings.
RHN Satellite or RHN Classic support will be disabled.
repolist: 0

STEP 2...
[root@jsefler-r63-server ~]# subscription-manager list --avail | grep awesomeos-server-basic-me -B1 -A5
ProductName:          	Awesome OS Server Basic (multi-entitlement)
ProductId:            	awesomeos-server-basic-me
PoolId:               	8a90f81435ace4270135ace53d460294
Quantity:             	10                       
Multi-Entitlement:    	Yes                      
Expires:              	03/21/2013               
MachineType:          	physical                 
--
ProductName:          	Awesome OS Server Basic (multi-entitlement)
ProductId:            	awesomeos-server-basic-me
PoolId:               	8a90f81435ace4270135ace53cfd0288
Quantity:             	5                        
Multi-Entitlement:    	Yes                      
Expires:              	03/21/2013               
MachineType:          	physical                 
[root@jsefler-r63-server ~]# subscription-manager subscribe --pool 8a90f81435ace4270135ace53d460294
Successfully consumed a subscription from the pool with id 8a90f81435ace4270135ace53d460294.

[root@jsefler-r63-server ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
RepoName:             	never-enabled-content    
RepoId:               	never-enabled-content    
RepoUrl:              	https://cdn.redhat.com/foo/path/never
Enabled:              	0                        

RepoName:             	always-enabled-content   
RepoId:               	always-enabled-content   
RepoUrl:              	https://cdn.redhat.com/foo/path/always
Enabled:              	1                        

RepoName:             	content                  
RepoId:               	content-label            
RepoUrl:              	https://cdn.redhat.com/foo/path
Enabled:              	1                        

[root@jsefler-r63-server ~]# yum repolist enabled
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
There was an error parsing the RHN proxy settings.
RHN Satellite or RHN Classic support will be disabled.
https://cdn.redhat.com/foo/path/always/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"
Trying other mirror.
repo id                                                            repo name                                                           status
always-enabled-content                                             always-enabled-content                                              0
content-label                                                      content                                                             0
repolist: 0

STEP 3...
[root@jsefler-r63-server ~]# sed -i "/\[always-enabled-content\]/,/\[/ s/^enabled\s*=.*/enabled=false/" /etc/yum.repos.d/redhat.repo

STEP 4...
[root@jsefler-r63-server ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
RepoName:             	never-enabled-content    
RepoId:               	never-enabled-content    
RepoUrl:              	https://cdn.redhat.com/foo/path/never
Enabled:              	0                        

RepoName:             	always-enabled-content   
RepoId:               	always-enabled-content   
RepoUrl:              	https://cdn.redhat.com/foo/path/always
Enabled:              	false                    

RepoName:             	content                  
RepoId:               	content-label            
RepoUrl:              	https://cdn.redhat.com/foo/path
Enabled:              	1                        

STEP 5...
[root@jsefler-r63-server ~]# yum repolist enabled
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
There was an error parsing the RHN proxy settings.
RHN Satellite or RHN Classic support will be disabled.
https://cdn.redhat.com/foo/path/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"
Trying other mirror.
repo id                                                               repo name                                                        status
content-label                                                         content                                                          0
repolist: 0

STEP 6...
[root@jsefler-r63-server ~]# subscription-manager unsubscribe --all
[root@jsefler-r63-server ~]# subscription-manager repos --list
The system is not entitled to use any repositories.

STEP 7...
[root@jsefler-r63-server ~]# subscription-manager unregister
System has been un-registered.

STEP 8...
[root@jsefler-r63-server ~]# subscription-manager repos --list
The system is not entitled to use any repositories.

STEP 9... WITHOUT RUNNING A YUM TRANSACTION, NOTICE THE redhat.repo IS STILL DIRTY
[root@jsefler-r63-server ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[content-label]
name = content
baseurl = https://cdn.redhat.com/foo/path
enabled = 1
gpgcheck = 1
gpgkey = https://cdn.redhat.com/foo/path/gpg/
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/9195373692866632040-key.pem
sslclientcert = /etc/pki/entitlement/9195373692866632040.pem
metadata_expire = 0

[always-enabled-content]
name = always-enabled-content
baseurl = https://cdn.redhat.com/foo/path/always
enabled = false
gpgcheck = 1
gpgkey = https://cdn.redhat.com/foo/path/always/gpg
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/9195373692866632040-key.pem
sslclientcert = /etc/pki/entitlement/9195373692866632040.pem
metadata_expire = 200

[never-enabled-content]
name = never-enabled-content
baseurl = https://cdn.redhat.com/foo/path/never
enabled = 0
gpgcheck = 1
gpgkey = https://cdn.redhat.com/foo/path/never/gpg
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/9195373692866632040-key.pem
sslclientcert = /etc/pki/entitlement/9195373692866632040.pem
metadata_expire = 600

STEP 10...
[root@jsefler-r63-server ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: b4f06eec-9816-40f1-bb6e-f143b1abf601 

STEP 11...
[root@jsefler-r63-server ~]# subscription-manager subscribe --pool 8a90f81435ace4270135ace53d460294
Successfully consumed a subscription from the pool with id 8a90f81435ace4270135ace53d460294.

STEP 12...
[root@jsefler-r63-server ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
RepoName:             	never-enabled-content    
RepoId:               	never-enabled-content    
RepoUrl:              	https://cdn.redhat.com/foo/path/never
Enabled:              	0                        

RepoName:             	always-enabled-content   
RepoId:               	always-enabled-content   
RepoUrl:              	https://cdn.redhat.com/foo/path/always
Enabled:              	false                    

RepoName:             	content                  
RepoId:               	content-label            
RepoUrl:              	https://cdn.redhat.com/foo/path
Enabled:              	1                        

[root@jsefler-r63-server ~]# yum repolist enabled
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
There was an error parsing the RHN proxy settings.
RHN Satellite or RHN Classic support will be disabled.
https://cdn.redhat.com/foo/path/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"
Trying other mirror.
repo id                                                               repo name                                                        status
content-label                                                         content                                                          0
repolist: 0
[root@jsefler-r63-server ~]# 

^^^ BANG!  THE ENABLED FLAG OF THE always-enabled-content REPO STILL SHOWS THE ORIGINAL MANUAL EDIT OF THE redhat.repo FILE.




One could argue that since the user manually edited the redhat.repo, then the sticky value is correct.  However, I would argue that the three events (unsubscribe --all, unregister, register) should each have wiped out all manual edits to the redhat.repo so as to prevent this situation from happening at all.

Comment 1 Adrian Likins 2012-03-02 17:49:42 UTC
On unregister, the issue seems to be that all the code to update repo's etc (repolib, certlib, and friends) fails when there is no
consumer cert. unregister command catches all exceptions and stops if it catches anything, so nothing get's done for updating these
repo's on unregister. Working on patch.

Comment 2 Chris Duryee 2012-03-05 14:47:30 UTC
1b5abbd9 master 0.99.8+

Comment 3 Shwetha Kallesh 2012-03-06 10:48:42 UTC
Moving to verified.

RPM used:
[root@dhcp201-162 ~]# rpm -qa | grep subscription-manager
subscription-manager-migration-0.99.8-1.git.22.c4b5c6a.el6.x86_64
subscription-manager-gnome-0.99.8-1.git.22.c4b5c6a.el6.x86_64
subscription-manager-firstboot-0.99.8-1.git.22.c4b5c6a.el6.x86_64
subscription-manager-debuginfo-0.99.8-1.el6.x86_64
subscription-manager-0.99.8-1.git.22.c4b5c6a.el6.x86_64


[root@dhcp201-162 ~]# sed -i "/\[always-enabled-content\]/,/\[/s/^enabled\s*=.*/enabled=false/" /etc/yum.repos.d/redhat.repo
[root@dhcp201-162 ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
RepoName:             	never-enabled-content    
RepoId:               	never-enabled-content    
RepoUrl:              	https://cdn.redhat.com/foo/path/never
Enabled:              	0                        

RepoName:             	always-enabled-content   
RepoId:               	always-enabled-content   
RepoUrl:              	https://cdn.redhat.com/foo/path/always
Enabled:              	false                    

RepoName:             	content                  
RepoId:               	content-label            
RepoUrl:              	https://cdn.redhat.com/foo/path
Enabled:              	1                        

[root@dhcp201-162 ~]# yum repolist enabled
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
https://cdn.redhat.com/foo/path/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"
Trying other mirror.
repo id                                                          repo name                                                                                        status
beaker-HighAvailability                                          beaker-HighAvailability                                                                             52
beaker-LoadBalancer                                              beaker-LoadBalancer                                                                                  2
beaker-ResilientStorage                                          beaker-ResilientStorage                                                                             58
beaker-ScalableFileSystem                                        beaker-ScalableFileSystem                                                                            7
beaker-Server                                                    beaker-Server                                                                                    3,529
content-label                                                    content                                                                                              0
rhel-x86_64-server-6                                             Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64)                                             0
repolist: 3,648
[root@dhcp201-162 ~]# subscription-manager unsubscribe --all
[root@dhcp201-162 ~]# 
[root@dhcp201-162 ~]# subscription-manager repos --list
The system is not entitled to use any repositories.
[root@dhcp201-162 ~]# subscription-manager unregister
System has been un-registered.
[root@dhcp201-162 ~]# 
[root@dhcp201-162 ~]# subscription-manager repos --list
The system is not entitled to use any repositories.
[root@dhcp201-162 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[root@dhcp201-162 ~]# subscription-manager register --username testuser1
WARNING

This system has already been registered with RHN using RHN Classic technology.

The tool you are using is attempting to re-register using RHN Certificate-Based technology. Red Hat recommends (except in a few cases) that customers only register with RHN once.

To learn more about RHN registration and technologies please consult this Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563
Password: 
User interrupted process.
[root@dhcp201-162 ~]# subscription-manager register --username testuser1 --password password --org admin
WARNING

This system has already been registered with RHN using RHN Classic technology.

The tool you are using is attempting to re-register using RHN Certificate-Based technology. Red Hat recommends (except in a few cases) that customers only register with RHN once.

To learn more about RHN registration and technologies please consult this Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563
The system has been registered with id: 8c73b972-2df5-4ff0-99a8-dc6e794cc697 
[root@dhcp201-162 ~]# subscription-manager subscribe --pool
Usage: subscription-manager subscribe [OPTIONS]

subscription-manager: error: --pool option requires an argument
[root@dhcp201-162 ~]# subscription-manager subscribe --pool 0000000035c785b40135c78688ea0289
Successfully consumed a subscription from the pool with id 0000000035c785b40135c78688ea0289.
[root@dhcp201-162 ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
RepoName:             	never-enabled-content    
RepoId:               	never-enabled-content    
RepoUrl:              	https://cdn.redhat.com/foo/path/never
Enabled:              	0                        

RepoName:             	always-enabled-content   
RepoId:               	always-enabled-content   
RepoUrl:              	https://cdn.redhat.com/foo/path/always
Enabled:              	1                        

RepoName:             	content                  
RepoId:               	content-label            
RepoUrl:              	https://cdn.redhat.com/foo/path
Enabled:              	1                        

[root@dhcp201-162 ~]# yum repolist enabled
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
https://cdn.redhat.com/foo/path/always/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"
Trying other mirror.
repo id                                                          repo name                                                                                        status
always-enabled-content                                           always-enabled-content                                                                           0
beaker-HighAvailability                                          beaker-HighAvailability                                                                          0
beaker-LoadBalancer                                              beaker-LoadBalancer                                                                              0
beaker-ResilientStorage                                          beaker-ResilientStorage                                                                          0
beaker-ScalableFileSystem                                        beaker-ScalableFileSystem                                                                        0
beaker-Server                                                    beaker-Server                                                                                    0
content-label                                                    content                                                                                          0
rhel-x86_64-server-6                                             Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64)                                         0
repolist: 0

Comment 5 errata-xmlrpc 2012-06-20 13:06:06 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.

http://rhn.redhat.com/errata/RHBA-2012-0804.html


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