Bug 1656389

Summary: FileExistsError: [Errno 17] File exists: '/var/cache/dnf' with registration
Product: Red Hat Enterprise Linux 8 Reporter: qianzhan
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED DUPLICATE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.0CC: csnyder, khowell, sgao, yanpliu
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-22 23:02:23 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

Description qianzhan 2018-12-05 12:01:12 UTC
Description of problem:
FileExistsError: [Errno 17] File exists: '/var/cache/dnf' with registration

Version-Release number of selected component (if applicable):
subscription-manager-1.23.8-4.el8.x86_64
subscription-manager-rhsm-certificates-1.23.8-4.el8.x86_64
python3-subscription-manager-rhsm-1.23.8-4.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-4.el8.x86_64

candlepin-2.5.8-1.el7.noarch
tfm-rubygem-katello-3.10.0-0.2.rc1.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch

How reproducible:
always

Steps to Reproduce:
1. Register RHEL-8.0-20181204.0 against Satellite6.5-snapshot6.0:

[root@dell-r730-002-guest16 product-default]# subscription-manager  register
Registering to: ibm-hs22-04.rhts.eng.brq.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 714c9248-ca3e-44ef-af50-6f0e229b1a1f
The registered system name is: dell-r730-002-guest16.dsal.lab.eng.rdu2.redhat.com
Failed to synchronize cache for repo 'myrepo_0', ignoring this repo.

2. Check rhsm.log:

2018-12-05 11:01:41,404 [ERROR] rhsmcertd-worker:11534:MainThread @base_action_client.py:72 - [Errno 17] File exists: '/var/cache/dnf'
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/base_action_client.py", line 62, in _run_update
    update_report = lib.update()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update
    self.report = self.locker.run(self._do_update)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run
    return action()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/packageprofilelib.py", line 26, in _do_update
    return action.perform()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/packageprofilelib.py", line 42, in perform
    ret = profile_mgr.update_check(self.uep, consumer_identity.uuid, force=force_upload)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 453, in update_check
    return CacheManager.update_check(self, uep, consumer_uuid, force)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 170, in update_check
    if self.has_changed() or force:
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 461, in has_changed
    return not cached_profile == self.current_profile
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 423, in current_profile
    module_profile = get_profile('modulemd').collect()
  File "/usr/lib64/python3.6/site-packages/rhsm/profile.py", line 347, in get_profile
    profile = PROFILE_MAP[profile_type]()
  File "/usr/lib64/python3.6/site-packages/rhsm/profile.py", line 54, in __init__
    self.content = self.__generate()
  File "/usr/lib64/python3.6/site-packages/rhsm/profile.py", line 76, in __generate
    base.fill_sack()
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 380, in fill_sack
    self._sack = dnf.sack._build_sack(self)
  File "/usr/lib/python3.6/site-packages/dnf/sack.py", line 89, in _build_sack
    dnf.util.ensure_dir(cachedir)
  File "/usr/lib/python3.6/site-packages/dnf/util.py", line 161, in ensure_dir
    raise e
  File "/usr/lib/python3.6/site-packages/dnf/util.py", line 158, in ensure_dir
    os.makedirs(dname, mode=0o755)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/var/cache/dnf'





Actual results:
As step 2, after registration, an FileExistsError found in rhsm.log.

Expected results:
No error.

Additional info:
Please see attachment 'rhsm.log'

Comment 1 qianzhan 2018-12-05 12:03:14 UTC
Created attachment 1511652 [details]
rhsm.log

Comment 2 Chris Snyder 2019-01-22 23:02:23 UTC

*** This bug has been marked as a duplicate of bug 1641648 ***