Leapp upgrade fails with "DNF execution failed with non zero exit code."
Environment
- Red Hat Enterprise Linux 7
- leapp
Issue
-
Upon executing
leapp upgradecommand, the command fails and the report shows issues related to conflicts, e.g./var/log/leapp/leapp-report.txtshows the followingRisk Factor: high (error) Title: DNF execution failed with non zero exit code. Summary: {"STDERR": "Warning: Package marked by Leapp to upgrade not found in repositories metadata: gpg-pubkey leapp-upgrade-el7toel8 leapp python2-leapp\nRPM: warning: Generating 6 missing index(es), please wait...\nError: Transaction test error:\n file /usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.opt-1.pyc from install of python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch\n file /usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.pyc from install of python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch\n file /usr/lib/python3.6/site-packages/six.py [...]
Resolution
-
Follow the procedure described in the Diagnostic Steps section.
If this is a match, proceed further, otherwise or if in doubt, open a case on the Customer Portal referencing this solution. -
Reminder: this solution handles errors related to conflicts, such as:
file /usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.opt-1.pyc from install of python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch
file /usr/lib/python3.6/site-packages/dateutil/__init__.py from install of python3-dateutil-1:2.6.1-6.el8.noarch conflicts with file from package python36-dateutil-1:2.4.2-5.el7.noarch
- The issues are with the RHEL7 packages, which are printed as last on each error line, e.g. "python36-six-1.14.0-3.el7.noarch" and "python36-dateutil-1:2.4.2-5.el7.noarch" in above excerpt.
-
Extract the list of problematic packages
You can extract the complete list of problematic packages through using the following command:
$ grep -oP "from package \K.*" /tmp/summary.out | sort -uIn our example above, this will lead to getting the following list:
python36-dateutil-1:2.4.2-5.el7.noarch python36-six-1.14.0-3.el7.noarch -
For each or a few of the problematic RHEL7 packages listed by the item in error, confirm whether the packages are shipped by Red Hat or not
# rpm -q --qf "%{NEVRA} --- %{VENDOR}\n" python36-dateutil-1:2.4.2-5.el7.noarch python36-six-1.14.0-3.el7.noarch python36-dateutil-1:2.4.2-5.el7.noarch --- Fedora Project python36-six-1.14.0-3.el7.noarch --- Fedora Project
- Here above, we can see that the vendor is not "Red Hat, Inc." but "Fedora Project", indicating that the packages are from 3rd party source.
-
For all the 3rd party packages found above, remove them from the system to resolve the conflicts
Note down the dependencies being removed, in case removing the packages also removes 3rd party software depending on those packages.
Later, after upgrade, you will have to reinstall the 3rd party software, e.g. a release compatible with RHEL8. -
Execute
leapp upgradeagain to confirm the issue is fixed
Root Cause
- leapp only supports upgrading packages shipped by Red Hat repositories, all other packages that may collide with Red Hat package content must usually be removed before proceeding with the upgrade.
Diagnostic Steps
-
Open the report with an editor, e.g. vim, then move to the failing item this solution is handlin:
Risk Factor: high (error) Title: DNF execution failed with non zero exit code. Summary: [...] -
Extract the content of the Summary line to a new file
When using vim, move to the opening bracket, hit "V" key (capital "v") then, while the line is highlighted, type ":w /tmp/line.out" then hit "Enter" key to create a temporary file containing only the highlighted line.
-
Reformat the error message in human-readable form
$ echo -e $(cat /tmp/line.out) > /tmp/summary.out -
Edit or cat the
/tmp/summary.outfile to see clearly which errors were happening$ cat /tmp/summary.out {"STDERR": "Warning: Package marked by Leapp to upgrade not found in repositories metadata: gpg-pubkey leapp-upgrade-el7toel8 leapp python2-leapp RPM: warning: Generating 6 missing index(es), please wait... Error: Transaction test error: file /usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.opt-1.pyc from install of python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch file /usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.pyc from install of python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch file /usr/lib/python3.6/site-packages/six.py from install of python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch [...]
- Here above, we can see conflicts errors, which are the errors this solution is dealing with.
Proceed to Resolution section. If you see other kind of errors, search the Knowledge Base for such errors or open a case on the Customer Portal.
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.