Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-3284

leapp fails while copying /etc/pki with broken relative symlinks

    • leapp-repository-0.19.0-5.el7_9
    • None
    • Low
    • rhel-sst-upgrades
    • 5
    • QE ack, Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • If docs needed, set a value
    • None

      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:

      1. mkdir -p /etc/pki/pulp/content
      2. cd /etc/pki/pulp/content
      3. ln -s ../ca.crt pulp-global-repo.ca
      4. ls /etc/pki/pulp/ca.crt
        ls: cannot access /etc/pki/pulp/ca.crt: No such file or directory
      5. 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)
      1. find /etc/ {pki,rhsm}-type l ! -exec test -e {} \; -print | xargs rm -fv
        
        

              pstodulk@redhat.com Petr Stodulka
              rhn-support-cbesson Christophe Besson
              Toshio Kuratomi Toshio Kuratomi
              Michal Macura Michal Macura
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: