系统版本:Rocky 8.10
报错信息:
Traceback (most recent call last):File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 14, in swig_import_helperreturn importlib.import_module(mname)File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)File "<frozen importlib._bootstrap>", line 994, in _gcd_importFile "<frozen importlib._bootstrap>", line 971, in _find_and_loadFile "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 658, in _load_unlockedFile "<frozen importlib._bootstrap>", line 571, in module_from_specFile "<frozen importlib._bootstrap_external>", line 922, in create_moduleFile "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /lib64/libxml2.so.2: file too shortDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/bin/yum", line 61, in <module>from dnf.cli import mainFile "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 30, in <module>import dnf.baseFile "/usr/lib/python3.6/site-packages/dnf/base.py", line 29, in <module>import libdnf.transactionFile "/usr/lib64/python3.6/site-packages/libdnf/__init__.py", line 8, in <module>from . import errorFile "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 17, in <module>_error = swig_import_helper()File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 16, in swig_import_helperreturn importlib.import_module('_error')File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_error'
解决方法:重新安装libxml2
下载libxml2安装包对应的rpm安装包:libxml2-2.9.7-18.el8.x86_64
卸载原本安装包
rpm -e --nodeps libxml2-2.9.7-18.el8.x86_64
重新安装
rpm -ivh libxml2-2.9.7-18.el8_10.1.x86_64.rpm
检查yum是否正常
yum repolist
故障原因
应该是有多个libxml2安装了,导致冲突。卸载重装即可。