Traceback (most recent call last):
File "/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
...
OSError: [Errno 2] No such file or directory: '/var/lib/rpm/Packages'
32 M untracked repos:
30 M /var/cache/yum/x86_64/7/alios.7u2.base.x86_64
1.5 M /var/cache/yum/x86_64/7/ops.7.x86_64
636 k /var/cache/yum/x86_64/7/ops.7.noarch
37 other data:
37 /var/cache/yum/x86_64/7/timedhosts
Error:
Problem: package dnf-4.0.9.2-1.el7_6.noarch conflicts with python2-dnf-plugins-core < 4.0.2 provided by python2-dnf-plugins-core-2.1.5-6.alios7.noarch
- package python2-dnf-plugin-leaves-2.1.5-6.alios7.noarch requires python2-dnf-plugins-core = 2.1.5-6.alios7, but none of the providers can be installed
- cannot install the best update candidate for package dnf-2.7.6-6.alios7.noarch
- problem with installed package python2-dnf-plugin-leaves-2.1.5-6.alios7.noarch
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)
改为执行:
yum upgrade dnf --allowerasing
此时提示
======================================================================================================================
Package Arch Version Repository Size
======================================================================================================================
Upgrading:
dnf noarch 4.0.9.2-1.el7_6 extras 357 k
dnf-plugins-core noarch 4.0.2.2-3.el7_6 extras 51 k
libdnf x86_64 0.22.5-1.el7_6 extras 533 k
libsolv x86_64 0.6.34-2.el7 base 328 k
python-urlgrabber noarch 3.10-9.el7 base 108 k
python2-dnf noarch 4.0.9.2-1.el7_6 extras 414 k
python2-dnf-plugin-versionlock noarch 4.0.2.2-3.el7_6 extras 44 k
python2-dnf-plugins-core noarch 4.0.2.2-3.el7_6 extras 165 k
python2-hawkey x86_64 0.22.5-1.el7_6 extras 68 k
Installing dependencies:
dnf-data noarch 4.0.9.2-1.el7_6 extras 51 k
replacing dnf-conf.noarch 2.7.6-6.alios7
libmodulemd x86_64 1.6.3-1.el7 extras 141 k
libsmartcols x86_64 2.23.2-59.el7_6.1 updates 140 k
libyaml x86_64 0.1.4-11.el7_0 base 55 k
python-dateutil noarch 1.5-7.el7 base 85 k
python-enum34 noarch 1.0.4-1.el7 base 52 k
python2-libdnf x86_64 0.22.5-1.el7_6 extras 608 k
yum noarch 3.4.3-161.el7.centos base 1.2 M
Removing dependent packages:
dnf-utils noarch 2.1.5-5.alios7 @System 4.0 k
python2-dnf-plugin-leaves noarch 2.1.5-6.alios7 @System 9.5 k
python2-dnf-plugin-show-leaves noarch 2.1.5-6.alios7 @System 4.7 k
yum-adapter noarch 0.1.0-7.alios7 @System 653
yum4 noarch 2.7.6-6.alios7 @System 0
Transaction Summary
======================================================================================================================
Install 8 Packages
Upgrade 9 Packages
Remove 5 Packages
注意,完成后还有一些残留alios的dnf软件包会影响工作,则检查系统看有哪些残留的 dnf form alios 软件包,逐个清理:
#rpm -qa | grep dnf | grep alios
dnf-plugins-p2p-0.1.0-1.alios7.noarch
执行清理命令
rpm -e dnf-plugins-p2p-0.1.0-1.alios7.noarch
dnf clean all
会报错
Traceback (most recent call last):
File "/bin/dnf", line 57, in <module>
from dnf.cli import main
File "/usr/lib/python2.7/site-packages/dnf/__init__.py", line 30, in <module>
import dnf.base
File "/usr/lib/python2.7/site-packages/dnf/base.py", line 29, in <module>
import libdnf.transaction
File "/usr/lib64/python2.7/site-packages/libdnf/__init__.py", line 3, in <module>
from . import conf
File "/usr/lib64/python2.7/site-packages/libdnf/conf.py", line 17, in <module>
_conf = swig_import_helper()
File "/usr/lib64/python2.7/site-packages/libdnf/conf.py", line 16, in swig_import_helper
return importlib.import_module('_conf')
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named _conf
# This file was automatically generated by SWIG (http://www.swig.org).# Version 3.0.12## Do not make changes to this file unless you know what you are doing--modify# the SWIG interface file instead.from sys import version_info as _swig_python_version_infoif _swig_python_version_info >= (2,7,0):defswig_import_helper():import importlib pkg =__name__.rpartition('.')[0] mname ='.'.join((pkg, '_conf')).lstrip('.')try:return importlib.import_module(mname)exceptImportError:return importlib.import_module('_conf') _conf =swig_import_helper()del swig_import_helper...
系统已经安装了swig,我尝试升级到刚放版本
尝试 yum install python3 提示有
File "/usr/lib/yum-plugins/branch.py", line 124, in getRhelRelease
if r[6] == '4':
#rpm -e python2-rpm-4.14.1-13.alios7.x86_64
error: Failed dependencies:
rpm-python >= 4.11.3-25.el7.centos.1 is needed by (installed) python2-dnf-4.0.9.2-1.el7_6.noarch
rpm-python is needed by (installed) yum-3.4.3-161.el7.centos.noarch
32 M untracked repos:
30 M /var/cache/yum/x86_64/7/alios.7u2.base.x86_64
1.5 M /var/cache/yum/x86_64/7/ops.7.x86_64
636 k /var/cache/yum/x86_64/7/ops.7.noarch
37 other data:
37 /var/cache/yum/x86_64/7/timedhosts
Traceback (most recent call last):
File "/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 375, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 239, in main
(result, resultmsgs) = base.buildTransaction()
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1198, in buildTransaction
(rescode, restring) = self.resolveDeps()
File "/usr/lib/python2.7/site-packages/yum/depsolve.py", line 893, in resolveDeps
CheckDeps, checkinstalls, checkremoves, missing = self._resolveRequires(errors)
File "/usr/lib/python2.7/site-packages/yum/depsolve.py", line 1009, in _resolveRequires
thisneeds = self._checkInstall(txmbr)
File "/usr/lib/python2.7/site-packages/yum/depsolve.py", line 1087, in _checkInstall
provs = self.tsInfo.getProvides(*req)
File "/usr/lib/python2.7/site-packages/yum/transactioninfo.py", line 636, in getProvides
result = self.getOldProvides(name, flag, version)
File "/usr/lib/python2.7/site-packages/yum/transactioninfo.py", line 629, in getOldProvides
for pkg, hits in self.rpmdb.getProvides(name, flag, version).iteritems():
File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 1497, in getProvides
pkgs = self.searchProvides(name)
File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 497, in searchProvides
ret = self.searchPrco(name, 'provides')
File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 476, in searchPrco
po = self._makePackageObject(hdr, idx)
File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 1377, in _makePackageObject
self._cached_rpmdb_mtime = os.path.getmtime(rpmdbfname)
File "/usr/lib64/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/var/lib/rpm/Packages'
BDB5105 Verification of /var/lib/rpm/Packages succeeded.
再次执行
yum clean all
这次提示信息似乎正常
warning: Found BDB Packages database while attempting lmdb backend: using bdb backend.
warning: Generating 18 missing index(es), please wait...
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras updates
Cleaning up list of fastest mirrors
Other repos take up 257 M of disk space (use --verbose for details)
现在解决了,可以使用yum了,只不过每次都会提示 warning: Found BDB Packages database while attempting lmdb backend: using bdb backend.
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
cat /var/log/rpmpkgs | sed 's,\.[^.]\+\.rpm$,,g' | while read nvr
do
yumdownloader --destdir=/var/tmp/recoverdb $nvr
done
重建rpm数据库
cd /var/tmp/recoverdb
ls *.rpm > MANIFEST
rpm -Uvh --noscripts --notriggers --force --justdb MANIFEST
出现报错
error: Failed dependencies:
libc.so.6 is needed by atk-2.28.1-1.el7.i686
...
libc.so.6(GLIBC_2.0) is needed by at-spi2-atk-2.26.2-1.el7.i686
...
libc.so.6(GLIBC_2.0) is needed by at-spi2-core-2.28.0-1.el7.i686
...