Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1156302

Summary: “Error loading certificate” when run "subscription-manager refresh" after reboot guest
Product: [Retired] Subscription Asset Manager Reporter: Liushihui <shihliu>
Component: katelloAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: SAM QE List <sam-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.4.1CC: ldai, qianzhan, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-26 20:35:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
rhsm.log
none
rhsm_20150929.log none

Description Liushihui 2014-10-24 06:49:59 UTC
Description of problem:
After reboot system, it will show "Error loading certificate" when run "subscription-manager refresh" and "subscription-manager list --consumed"

Version-Release number of selected component (if applicable):
katello-headpin-1.4.3.28-1.el6sam_splice.noarch
candlepin-0.9.6.5-1.el6sam.noarch
subscription-manager-1.10.14-7.el7.x86_64
python-rhsm-1.10.12-2.el7.x86_64

How reproducible:
20%

Steps to Reproduce:
Precondition: rhel7 guest installed on Rhev-hypervisor6-6.5-20141017.0.  

1.Register vm to SAM server
[root@dhcp-66-103-114 ~]# subscription-manager register --username=admin --password=admin
The system has been registered with ID: 7a4b641b-e6c6-4108-b4d0-8bda6fad19e9 
2.Auto subscribe on the vm.
[root@dhcp-66-103-114 ~]# subscription-manager subscribe --pool=8ac2019c48f80ce001493feee2023ec9
Successfully attached a subscription for: Red Hat Enterprise Linux for Virtual Datacenters, Standard
[root@dhcp-66-103-114 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux for Virtual Datacenters, Standard
Provides:          Oracle Java (for RHEL Server)
                   Red Hat Developer Toolset (for RHEL Server)
                   Red Hat Software Collections Beta (for RHEL Server)
                   Red Hat Enterprise Linux Server
                   Red Hat Beta
                   Red Hat Software Collections (for RHEL Server)
SKU:               RH00050
Contract:          
Account:           
Serial:            3824853241218552091
Pool ID:           8ac2019c48f80ce001493feee2023ec9
Active:            True
Quantity Used:     1
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Stackable
Starts:            12/31/2013
Ends:              12/30/2014
System Type:       Virtual

3. Make sure the time in the vm is the same as sam server
SAM Server:
[root@samserv ~]# date
Fri Oct 24 02:40:18 EDT 2014
VM:
[root@dhcp-66-103-114 ~]# date
Fri Oct 24 02:41:39 EDT 2014

4.Stop the vm , then start the vm on the rhevm web UI.

5.After vm has been start, refresh the subscription.
[root@dhcp-66-103-114 ~]# subscription-manager refresh
Error loading certificate
[root@dhcp-66-103-114 ~]# subscription-manager identity
system identity: 7a4b641b-e6c6-4108-b4d0-8bda6fad19e9
name: dhcp-66-103-114
org name: ACME_Corporation
org ID: ACME_Corporation

6. Check the virt-who log under the /var/log/rhsm/rhsm.log

Actual results:
It show some error log as the following.please see the detail in the attachment.
2014-10-23 23:20:55,068 [ERROR] subscription-manager @managercli.py:156 - Unable to perform refresh due to the following exception: Error loading certificate
2014-10-23 23:20:55,068 [ERROR] subscription-manager @managercli.py:157 - Error loading certificate
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 541, in _do_command
    self.certlib.update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 69, in update
    return self._do_update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 92, in _do_update
    return action.perform(lock=self.lock)
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 233, in perform
    local = self._get_local_serials(report)
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 296, in _get_local_serials
    for valid in self.entdir.list():
  File "/usr/share/rhsm/subscription_manager/certdirectory.py", line 119, in list
    listing.append(create_from_file(path))
  File "/usr/lib64/python2.7/site-packages/rhsm/certificate.py", line 59, in create_from_file
    return _CertFactory().create_from_file(path)
  File "/usr/lib64/python2.7/site-packages/rhsm/certificate2.py", line 66, in create_from_file
    return self._read_x509(_certificate.load(path), path, pem)
  File "/usr/lib64/python2.7/site-packages/rhsm/certificate2.py", line 78, in _read_x509
    raise CertificateException("Error loading certificate")
CertificateException: Error loading certificate


Expected results:
It should success to refresh and list consumed subscriptions after restart vm.

Additional info:
It still can list the available subscriptions after occur this problem on the vm.

Comment 1 Liushihui 2014-10-24 06:51:53 UTC
Created attachment 950242 [details]
rhsm.log

Comment 2 Liushihui 2015-09-29 09:35:02 UTC
It still exist on SAM-1.4.1-RHEL-6-20141113.0. it was reproduced when testing RHEL7.2-20150924.0-Server-x86_64(KVM) against SAM-1.4.1-RHEL-6-20141113.0. please see the detail log on attachment rhsm_20150929.log

Comment 3 Liushihui 2015-09-29 09:35:32 UTC
Created attachment 1078265 [details]
rhsm_20150929.log

Comment 4 Liushihui 2016-01-12 02:34:50 UTC
It also reproduced when testing RHEL6.8-20160111.n.0-Server-x86_64(KVM) against SAM-1.4.1-RHEL-6-20141113.0

Comment 5 Liushihui 2016-01-13 01:42:41 UTC
It also exist on Satellite-6.1.0-RHEL-7-20160107.0. please refer to bug 1267188

Comment 6 Bryan Kearney 2017-06-26 20:35:21 UTC
The release of Satellite 5.8 we are deprecating the support of Subscription Asset Manager. The release notes for 5.8 can be found at https://access.redhat.com/documentation/en-us/red_hat_satellite/5.8/pdf/release_notes/Red_Hat_Satellite-5.8-Release_Notes-en-US.pdf.

I am therefore closing out this bug as WONTFIX. If you believe this to be an error, please feel free tor each out to either Rich Jerrido or Bryan Kearney. Thank you!