Bug 812446

Summary: If yum runs with no enabled or active repo's, we delete the product cert
Product: Red Hat Enterprise Linux 6 Reporter: RHEL Program Management <pm-rhel>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: urgent Docs Contact:
Priority: high    
Version: 6.3CC: alikins, awood, bkearney, cduryee, cww, dgregor, jlaska, jmolet, jsefler, pm-eus, syeghiay, whayutin
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-10 06:38:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 806457    
Bug Blocks: 738066    

Description RHEL Program Management 2012-04-13 18:42:00 UTC
This bug has been copied from bug #806457 and has been proposed
to be backported to 6.2 z-stream (EUS).

Comment 4 Alex Wood 2012-04-18 17:48:27 UTC
Committed d4983e05bc98c05da7cd1a95f85987c5fc85da36 to RHEL6.2 branch

Comment 6 John Sefler 2012-04-25 19:53:05 UTC
Demonstrating the error on a current RHEL62 system before applying fix...

[root@rhsm-compat-rhel62 ~]# rpm -q subscription-manager
subscription-manager-0.96.17-1.el6.x86_64


Fetching an rpm that we will use for testing purposes and backing up some files that I already know will be destroyed as a consequence of this bug...
[root@rhsm-compat-rhel62 ~]# wget -q -O /tmp/zsh.rpm http://download.devel.redhat.com/brewroot/packages/zsh/4.3.10/4.1.el6/x86_64/zsh-4.3.10-4.1.el6.x86_64.rpm
[root@rhsm-compat-rhel62 ~]# cp /etc/pki/product/69.pem /tmp
[root@rhsm-compat-rhel62 ~]# cp /var/lib/rhsm/productid.js /tmp
[root@rhsm-compat-rhel62 ~]# 

[root@rhsm-compat-rhel62 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Server
Version:            	6.2                      
Arch:               	x86_64                   
Status:             	Not Subscribed           
Starts:             	                         
Expires:            	                         

[root@rhsm-compat-rhel62 ~]# cat /var/lib/rhsm/productid.js
{
  "69":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@rhsm-compat-rhel62 ~]# 

^^^ PRODUCT ID 69 IS INSTALLED AND LIFE IS GOOD
    NOW LET'S YUM INSTALL A LOCAL PACKAGE


[root@rhsm-compat-rhel62 ~]# yum repolist
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security,
              : subscription-manager
Updating certificate-based repositories.
This system is not registered with RHN.
RHN Satellite or RHN Classic support will be disabled.
repolist: 0
[root@rhsm-compat-rhel62 ~]# yum -q -y localinstall /tmp/zsh.rpm 
This system is not registered with RHN.
RHN Satellite or RHN Classic support will be disabled.
Warning: RPMDB altered outside of yum.
[root@rhsm-compat-rhel62 ~]# rpm -q zsh
zsh-4.3.10-4.1.el6.x86_64
[root@rhsm-compat-rhel62 ~]# 

^^^ AN RPM HAS BEEN LOCALLY INSTALLED WHILE NO REPOS ARE ACTIVE repolist:0
    THE CONSEQUENCE IS...


[root@rhsm-compat-rhel62 ~]# subscription-manager list --installed
No installed Products to list
[root@rhsm-compat-rhel62 ~]# cat /var/lib/rhsm/productid.js
{}[root@rhsm-compat-rhel62 ~]# 

^^^ THE INSTALLED PRODUCT ID 69 HAS BEEN DELETED!  THAT'S BAD.



Restoring backed-up files before applying the fix..
[root@rhsm-compat-rhel62 ~]# cp /tmp/productid.js /var/lib/rhsm
cp: overwrite `/var/lib/rhsm/productid.js'? y
[root@rhsm-compat-rhel62 ~]# cp /tmp/69.pem /etc/pki/product/
[root@rhsm-compat-rhel62 ~]#

Comment 7 John Sefler 2012-04-25 20:17:27 UTC
Applying the new subscription-manager and demonstrating the fix...

[root@rhsm-compat-rhel62 ~]# rpm -U http://download.devel.redhat.com/brewroot/packages/subscription-manager/0.96.18/1.el6_2/x86_64/subscription-manager-0.96.18-1.el6_2.x86_64.rpm
[root@rhsm-compat-rhel62 ~]# rpm -q subscription-manager
subscription-manager-0.96.18-1.el6_2.x86_64
[root@rhsm-compat-rhel62 ~]# 


[root@rhsm-compat-rhel62 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Server
Version:            	6.2                      
Arch:               	x86_64                   
Status:             	Not Subscribed           
Starts:             	                         
Expires:            	                         

[root@rhsm-compat-rhel62 ~]# cat /var/lib/rhsm/productid.js
{
  "69":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@rhsm-compat-rhel62 ~]# 

^^^ PRODUCT ID 69 IS INSTALLED AND LIFE IS GOOD
    NOW LET'S YUM INSTALL A LOCAL PACKAGE


[root@rhsm-compat-rhel62 ~]# yum repolist
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security,
              : subscription-manager
Updating certificate-based repositories.
This system is not registered with RHN.
RHN Satellite or RHN Classic support will be disabled.
repolist: 0
[root@rhsm-compat-rhel62 ~]# rpm -e zsh
[root@rhsm-compat-rhel62 ~]# yum -q -y localinstall /tmp/zsh.rpm
This system is not registered with RHN.
RHN Satellite or RHN Classic support will be disabled.
Warning: RPMDB altered outside of yum.
[root@rhsm-compat-rhel62 ~]# rpm -q zsh
zsh-4.3.10-4.1.el6.x86_64
[root@rhsm-compat-rhel62 ~]# 

^^^ AN RPM HAS BEEN LOCALLY INSTALLED WHILE NO REPOS ARE ACTIVE repolist:0
    LET'S VERIFY THE INSTALLED PRODUCT REMAINS...


[root@rhsm-compat-rhel62 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Server
Version:            	6.2                      
Arch:               	x86_64                   
Status:             	Not Subscribed           
Starts:             	                         
Expires:            	                         

[root@rhsm-compat-rhel62 ~]# cat /var/lib/rhsm/productid.js
{
  "69":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@rhsm-compat-rhel62 ~]# 

^^^ YES.  THE INSTALLED PRODUCT REMAINS INSTALLED.  BUG FIX IS VERIFIED!

Comment 8 John Sefler 2012-04-26 16:55:10 UTC
Also confirmed that the failure in comment 6 occurs on s390x with...
[root@ibm-z10-29 ~]# rpm -q subscription-manager
subscription-manager-0.96.17-1.el6.s390x

And VERIFIED that the fix in comment 7 occurs occurs on s390x with...
[root@ibm-z10-29 ~]# rpm -q subscription-manager
subscription-manager-0.96.18-1.el6_2.s390x

Comment 9 errata-xmlrpc 2012-05-10 06:38:18 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-0562.html