Leapp preupgrade fails with `ImportError: cannot import name report_inhibitors` error when performing in-place upgrade of Red Hat Satellite 6.11 server

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.11
  • Red Hat Enterprise Linux 7.9

Issue

  • Following the procedure outlined in Chapter 4. Upgrading Satellite or Capsule to Red Hat Enterprise Linux 8 In-Place Using Leapp to perform a leapp upgrade of Red Hat Satellite 6.11 server, the leapp preupgrade command in step (6) failed with the following backtrace:

    # leapp preupgrade
    Traceback (most recent call last):
      File "/bin/leapp", line 9, in <module>
        load_entry_point('leapp==0.16.0', 'console_scripts', 'leapp')()
      File "/usr/lib/python2.7/site-packages/leapp/cli/__init__.py", line 43, in main
        _load_commands(cli.command)
      File "/usr/lib/python2.7/site-packages/leapp/cli/__init__.py", line 27, in _load_commands
        package = pkgutil.get_loader(package_name).load_module(package_name)
      File "/usr/lib64/python2.7/pkgutil.py", line 246, in load_module
        mod = imp.load_module(fullname, self.file, self.filename, self.etc)
      File "/usr/lib/python2.7/site-packages/leapp/cli/commands/list_runs/__init__.py", line 6, in <module>
        from leapp.cli.commands.upgrade.util import fetch_all_upgrade_contexts
      File "/usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py", line 12, in <module>
        from leapp.utils.output import beautify_actor_exception, report_errors, report_info, report_inhibitors
    ImportError: cannot import name report_inhibitors
    

Resolution

  1. Apply the steps in the Diagnostic Steps section of this solution. If the outcomes match, proceed with the next steps.

  2. Update the python-libs and leapp-upgrade-el7toel8 packages on the Satellite server:

       # satellite-maintain packages unlock
    
       # yum update python-libs
    
       # yum update leapp-upgrade-el7toel8
    
       # satellite-maintain packages lock
    
  3. Verify that the outputs from the following commands match with the correct outputs as described in the Diagnostic Steps section of the solution:

  # ls -ltr /usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py

  # rpm -qf /usr/lib/python2.7/site-packages/leapp/cli/*

  # rpm -qf /usr/lib64/python2.7/pkgutil.py
  1. Rerun the command:
# leapp preupgrade

For more KB articles/solutions related to Red Hat Satellite 6.x LEAPP Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x LEAPP Issues

Diagnostic Steps

  • Verify the size of the /usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py file referred to in the traceback:

    # ls -ltr /usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py
    -rw-r--r-- 1 root root 6218  5 Jun   2023 /usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py
    

    The correct size should be:

    # ls -ltr /usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py
    -rw-r--r--. 1 root root 6201 Aug 23 14:40 /usr/lib/python2.7/site-packages/leapp/cli/commands/upgrade/__init__.py
    
  • Examine the output from the following commands:

      # rpm -qf /usr/lib/python2.7/site-packages/leapp/cli/*
      leapp-upgrade-el7toel8-0.18.0-3.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
    
      # rpm -qf /usr/lib64/python2.7/pkgutil.py
      python-libs-2.7.5-93.el7_9.x86_64
    

    The correct package versions are:

      # rpm -qf /usr/lib/python2.7/site-packages/leapp/cli/*
      leapp-0.16.0-1.el7_9.noarch
      leapp-upgrade-el7toel8-0.19.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
      leapp-0.16.0-1.el7_9.noarch
    
      # rpm -qf /usr/lib64/python2.7/pkgutil.py
      python-libs-2.7.5-94.el7_9.x86_64
    
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.