Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1969978

Summary: leapp fails while copying /etc/pki with broken relative symlinks
Product: Red Hat Enterprise Linux 7 Reporter: Christophe Besson <cbesson>
Component: leapp-repositoryAssignee: Leapp Notifications Bot <leapp-notifications-bot>
Status: CLOSED MIGRATED QA Contact: upgrades-and-conversions
Severity: low Docs Contact:
Priority: low    
Version: 7.9CC: fkrska, kkinge
Target Milestone: rcKeywords: MigratedToJIRA, Reproducer
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-12 11:20:20 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:
Bug Depends On:    
Bug Blocks: 1818088    

Description Christophe Besson 2021-06-09 14:59:12 UTC
Description of problem:
During the leapp upgrade, customer reported the following issue:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 72, in _do_run
    actor_instance.run(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 335, in run
    self.process(*args)
  File "/usr/lib/python2.7/site-packages/leapp/utils/deprecation.py", line 42, in process_wrapper
    return target_item(*args, **kwargs)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/targetuserspacecreator/actor.py", line 43, in process
    userspacegen.perform()
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/targetuserspacecreator/libraries/userspacegen.py", line 478, in perform
    _create_target_userspace(context, indata.packages, target_repoids)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/targetuserspacecreator/libraries/userspacegen.py", line 457, in _create_target_userspace
    _prep_repository_access(context, constants.TARGET_USERSPACE)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/targetuserspacecreator/libraries/userspacegen.py", line 144, in _prep_repository_access
    context.copytree_from('/etc/pki', os.path.join(target_userspace, 'etc', 'pki'))
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/mounting.py", line 198, in copytree_from
    shutil.copytree(self.full_path(src), dst)
  File "/usr/lib64/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/var/lib/leapp/scratch/mounts/root_/system_overlay/etc/pki/tls/certs/57dcc1cc.0', '/var/lib/leapp/el8userspace/etc/pki/tls/certs/57dcc1cc.0', "[Errno 2] No such file or directory: '/var/lib/leapp/scratch/mounts/root_/system_overlay/etc/pki/tls/certs/57dcc1cc.0'"), ('/var/lib/leapp/scratch/mounts/root_/system_overlay/etc/pki/pulp/content/e097f848.r0', '/var/lib/leapp/el8userspace/etc/pki/pulp/content/e097f848.r0', "[Errno 2] No such file or directory: '/var/lib/leapp/scratch/mounts/root_/system_overlay/etc/pki/pulp/content/e097f848.r0'"), ('/var/lib/leapp/scratch/mounts/root_/system_overlay/etc/pki/pulp/content/pulp-global-repo.ca', '/var/lib/leapp/el8userspace/etc/pki/pulp/content/pulp-global-repo.ca', "[Errno 2] No such file or directory: '/var/lib/leapp/scratch/mounts/root_/system_overlay/etc/pki/pulp/content/pulp-global-repo.ca'")]

As per the `ls -lR /etc/pki` output, the following relative symlinks are broken:
	/etc/pki/pulp/content:
	total 0
	lrwxrwxrwx. 1 root root 36 May 29  2018 e097f848.r0 -> /var/lib/candlepin/candlepin-crl.crl
	lrwxrwxrwx. 1 root root 20 May 29  2018 pulp-global-repo.ca -> /etc/pki/pulp/ca.crt

	/etc/pki/tls/certs:
	total 48
	lrwxrwxrwx. 1 root root   29 May 15  2017 57dcc1cc.0 -> subscriptionrhsmredhatcom.pem

Version-Release number of selected component (if applicable):
leapp-repository-0.14.0-4.el7_9

How reproducible:
100%

Steps to Reproduce:

	# mkdir -p /etc/pki/pulp/content
	# cd /etc/pki/pulp/content
	# ln -s ../ca.crt pulp-global-repo.ca
	# ls /etc/pki/pulp/ca.crt
	ls: cannot access /etc/pki/pulp/ca.crt: No such file or directory
	# leapp upgrade

Actual results:
Python traceback above

Expected results:
No traceback, content of /etc/pki copied into the "target userspace", possibly a check similar to the workaround I suggested (see below).

Additional info:
* I'm unable to reproduce this issue with an absolute symlink like this one:
"e097f848.r0 -> /var/lib/candlepin/candlepin-crl.crl" (where the latter doesn't exist)
=> In this case, the upgrade is inhibited with "Upgrade requires links in root directory to be relative"

* Suggested workaround (awaiting for the feedback)
# find /etc/{pki,rhsm} -type l ! -exec test -e {} \; -print | xargs rm -fv

Comment 4 RHEL Program Management 2023-09-12 11:05:03 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 5 RHEL Program Management 2023-09-12 11:20:20 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.