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 2088769

Summary: Leapp fails with a traceback due to a missing /var/lib/leapp/el8userspace/etc/yum.repos.d dir
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: pstodulk, sujagtap
Target Milestone: rcKeywords: MigratedToJIRA
Target Release: ---Flags: pm-rhel: mirror+
Hardware: s390x   
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 12:23:48 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:

Description Christophe Besson 2022-05-20 14:54:29 UTC
Description of problem:
Customer is using properly defined custom repositories, the preugprade begins but fails early due to a missing /var/lib/leapp/el8userspace/etc/yum.repos.d.
Removing the directory and trying again does not help.

Version-Release number of selected component (if applicable):
0.16

How reproducible:
Always for the customer, unable to reproduce internally.

Steps to Reproduce:
1. Define custom HTTP repositories for el7 in /etc/yum.repos.d and custom HTTP repos for el8 in /etc/leapp/files/leapp_upgrade_repositories.repo
2. Execute leapp by enabling those custom el8 repos and disable rhsm

Actual results:
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/share/leapp-repository/repositories/system_upgrade/common/actors/targetuserspacecreator/actor.py", line 52, in process
    userspacegen.perform()
  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/common/actors/targetuserspacecreator/libraries/userspacegen.py", line 681, in perform
    _create_target_userspace(context, indata.packages, indata.files, target_repoids)
  File "/usr/share/leapp-repository/repositories/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py", line 655, in _create_target_userspace
    _prep_repository_access(context, target_path)
  File "/usr/share/leapp-repository/repositories/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py", line 246, in _prep_repository_access
    files_owned_by_rpms = _get_files_owned_by_rpms(target_context, '/etc/yum.repos.d')
  File "/usr/share/leapp-repository/repositories/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py", line 214, in _get_files_owned_by_rpms
    for fname in os.listdir(context.full_path(dirpath)):
OSError: [Errno 2] No such file or directory: '/var/lib/leapp/el8userspace/etc/yum.repos.d'

Additional info:
- I didn't find anything in the logs or even in the strace which could explain this:
13463 16:48:04.672460 openat(AT_FDCWD, "/var/lib/leapp/el8userspace/etc/yum.repos.d", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory) <0.000009>

- Creating the directory in question and copying the repo file workarounds the issue:
In `/usr/share/leapp-repository/repositories/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py`, at the beginning of _get_files_owned_by_rpms(), adding these lines before the error occurs:

    if dirpath == "/etc/yum.repos.d":
        api.current_logger().debug('RECREATING YUM.REPOS.D')
        run(['cp', '-rf', '/etc/yum.repos.d', '/var/lib/leapp/el8userspace/etc/'])
        run(['cp', '-f', '/etc/leapp/files/leapp_upgrade_repositories.repo', '/var/lib/leapp/el8userspace/etc/yum.repos.d/'])

Comment 16 Petr Stodulka 2023-07-28 11:07:32 UTC
Discussed internally, it's possible the bug could be fixed by the redesigned use of OVL during in-place upgrades:
  https://github.com/oamg/leapp-repository/pull/1097

Is customer willing to test the upstream devel build? As we cannot reproduce the issue, we have no way to anyhow test whether the problem has been resolved or not.

Upstream COPR repo file, modified for s390x (note the x86:64 in url is ok):
~~~~
[copr:copr.fedorainfracloud.org:group_oamg:leapp]
name=Copr repo for leapp owned by @oamg
baseurl=https://download.copr.fedorainfracloud.org/results/@oamg/leapp/epel-7-x86_64/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@oamg/leapp/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
~~~~

For the installation execute:
~~~
  # yum install leapp-upgrade -y
~~~

In case of testing with the devel builds, we suggest to execute leapp with the --target option, e.g.:
  # leapp preupgrade --target 8.8 --debug


Note: Setting the stale date to May 2024.

Comment 17 RHEL Program Management 2023-09-12 12:00:24 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 18 RHEL Program Management 2023-09-12 12:23:48 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.