leapp upgrade报错:Message: DNF execution failed with non zero exit code.

现象: CentOS7使用leapp upgrade 到Rocky Linux8时报错,升级失败。

主要错误消息有如下几条:

  1. Message: DNF execution failed with non zero exit code.
  2. Repository extras is listed more than once in the configuration
  3. python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch
    详细日志如下。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    [root@as ~]# leapp upgrade
    ...
    ============================================================
    ERRORS
    ============================================================

    2024-05-23 18:47:52.063859 [ERROR] Actor: dnf_package_download
    Message: DNF execution failed with non zero exit code.
    STDOUT:
    Last metadata expiration check: 0:01:24 ago on Thu May 23 18:44:59 2024.
    Package python2-six-1.9.0-0.el7.noarch is already installed.
    Dependencies resolved.

    ...

    Running transaction test
    The downloaded packages were saved in cache until the next successful transaction.
    You can remove cached packages by executing 'dnf clean packages'.

    STDERR:
    Failed to create directory /var/lib/leapp/el8userspace//sys/fs/selinux: Read-only file system
    Failed to create directory /var/lib/leapp/el8userspace//sys/fs/selinux: Read-only file system
    No matches found for the following disable plugin patterns: subscription-manager
    Repository extras is listed more than once in the configuration
    Warning: Package marked by Leapp to upgrade not found in repositories metadata: gpg-pubkey
    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
    file /usr/lib/python3.6/site-packages/urllib3/__init__.py from install of python3-urllib3-1.24.2-7.el8.noarch conflicts with file from package python36-urllib3-1.25.6-2.el7.noarch
    file /usr/lib/python3.6/site-packages/urllib3/__pycache__/__init__.cpython-36.opt-1.pyc from install of python3-urllib3-1.24.2-7.el8.noarch conflicts with file from package python36-urllib3-1.25.6-2.el7.noarch
    file /usr/lib/python3.6/site-packages/urllib3/__pycache__/__init__.cpython-36.pyc from install of python3-urllib3-1.24.2-7.el8.noarch conflicts with file from package python36-urllib3-1.25.6-2.el7.noarch
    ...
    file /usr/lib/python3.6/site-packages/chardet/cli/__pycache__/chardetect.cpython-36.opt-1.pyc from install of python3-chardet-3.0.4-7.el8.noarch conflicts with file from package python36-chardet-3.0.4-1.el7.noarch
    file /usr/lib/python3.6/site-packages/chardet/cli/__pycache__/chardetect.cpython-36.pyc from install of python3-chardet-3.0.4-7.el8.noarch conflicts with file from package python36-chardet-3.0.4-1.el7.noarch
    file /usr/lib/python3.6/site-packages/chardet/cli/chardetect.py from install of python3-chardet-3.0.4-7.el8.noarch conflicts with file from package python36-chardet-3.0.4-1.el7.noarch
    file /usr/lib/python3.6/site-packages/requests/__init__.py from install of python3-requests-2.20.0-4.el8.noarch conflicts with file from package python36-requests-2.14.2-2.el7.noarch
    file /usr/lib/python3.6/site-packages/requests/__pycache__/__init__.cpython-36.opt-1.pyc from install of python3-requests-2.20.0-4.el8.noarch conflicts with file from package python36-requests-2.14.2-2.el7.noarch
    file /usr/lib/python3.6/site-packages/requests/__pycache__/__init__.cpython-36.pyc from install of python3-requests-2.20.0-4.el8.noarch conflicts with file from package python36-requests-2.14.2-2.el7.noarch
    ...
    file /usr/lib64/python3.6/site-packages/_yaml.cpython-36m-x86_64-linux-gnu.so from install of python3-pyyaml-3.12-12.el8.x86_64 conflicts with file from package python36-PyYAML-3.13-1.el7.x86_64
    file /usr/lib64/python3.6/site-packages/yaml/__init__.py from install of python3-pyyaml-3.12-12.el8.x86_64 conflicts with file from package python36-PyYAML-3.13-1.el7.x86_64
    file /usr/lib64/python3.6/site-packages/yaml/__pycache__/__init__.cpython-36.opt-1.pyc from install of python3-pyyaml-3.12-12.el8.x86_64 conflicts with file from package python36-PyYAML-3.13-1.el7.x86_64
    ...

    ============================================================
    END OF ERRORS
    ============================================================


    Debug output written to /var/log/leapp/leapp-upgrade.log

    ============================================================
    REPORT
    ============================================================

    A report has been generated at /var/log/leapp/leapp-report.json
    A report has been generated at /var/log/leapp/leapp-report.txt

    ============================================================
    END OF REPORT
    ============================================================

    Answerfile has been generated at /var/log/leapp/answerfile
    2024-05-23 18:47:52.575 ERROR PID: 28176 leapp: Upgrade workflow failed, check log for details

原因分析:错误信息提示DNF安装包的时候,返回值不为0,触发异常。

python包显示冲突,前面的平台是 el8 后面的平台是 el7 ,猜测是升级过程中要装 el8 平台的python3-six包,
但是和现有的 el7 平台的包发生冲突,导致异常。于是根据日志里面显示的包名,尝试暂时移除掉,错误消失顺利升级成功。
【python3-six-1.11.0-8.el8.noarch conflicts with file from package python36-six-1.14.0-3.el7.noarch】

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[root@as ~]# yum remove -y python36-six python36-urllib3 python36-chardet python36-requests python36-PyYAML
[root@as ~]# leapp upgrade
...
DNF will only download packages, install gpg keys, and check the transaction.
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
====> * add_upgrade_boot_entry
Add new boot entry for Leapp provided initramfs.
A reboot is required to continue. Please reboot your system.


Debug output written to /var/log/leapp/leapp-upgrade.log

============================================================
REPORT
============================================================

A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt

============================================================
END OF REPORT
============================================================

Answerfile has been generated at /var/log/leapp/answerfile