Centos 7 yum update 中断导致的软件包duplicate重复问题

Error: Package: glibc-common-2.17-260.el7_6.5.x86_64 (@updates)
Requires: glibc = 2.17-260.el7_6.5
Removing: glibc-2.17-260.el7_6.5.i686 (@updates)
glibc = 2.17-260.el7_6.5
Updated By: glibc-2.17-292.el7.i686 (base)
glibc = 2.17-292.el7
You could try using –skip-broken to work around the problem
** Found 44 pre-existing rpmdb problem(s), ‘yum check’ output follows:
1:NetworkManager-libnm-1.18.0-5.el7_7.1.x86_64 is a duplicate with 1:NetworkManager-libnm-1.12.0-10.el7_6.x86_64
32:bind-license-9.11.4-9.P2.el7.noarch is a duplicate with 32:bind-license-9.9.4-73.el7_6.noarch
cpp-4.8.5-39.el7.x86_64 is a duplicate with cpp-4.8.5-36.el7_6.2.x86_64
dracut-033-564.el7.x86_64 is a duplicate with dracut-033-554.el7.x86_64
e2fsprogs-libs-1.42.9-16.el7.x86_64 is a duplicate with e2fsprogs-libs-1.42.9-13.el7.x86_64
elfutils-libelf-0.176-2.el7.x86_64 is a duplicate with elfutils-libelf-0.172-2.el7.i686

 

上面是一大堆报错,解决命令:

包名是错误输出中最前面的名字,如上面的 NetworkManager-libnm-1.18.0-5.el7_7.1.x86_64,注意不要带上前面的数字

如果重复包太多,可以把错误输出保存到文件中,假设名为f,然后用命令行处理只保留下开头的名字,并去除最前面的数字,这里我们用vim打开后解决。

先按ESC,再键入如下字符后回车

同上键入如下字符后回车:

处理后会变为如下:

再用rpm命令解决重复问题: