CentOS更新软件包重复错误

这两天在用yum更新CentOS的时候,出现了软件包重复现错误。虽然已经不是第一次遇到这个问题,但距上次遇到时已经过了很久,早已忘记当时是如何解决的了,结果又花了好久才得以解决,这次吸取教训记下来,以免再忘。。。

错误信息大致如下:

Error: Package: coreutils-8.4-8.fc13.i686 (@updates)
           Requires: coreutils-libs = 8.4-8.fc13
           Removing: coreutils-libs-8.4-8.fc13.i686 (@updates)
               coreutils-libs = 8.4-8.fc13
           Updated By: coreutils-libs-8.4-9.fc13.i686 (updates)
               coreutils-libs = 8.4-9.fc13
           Available: coreutils-libs-8.4-6.fc13.i686 (fedora)
               coreutils-libs = 8.4-6.fc13
 You could try using --skip-broken to work around the problem
** Found 8 pre-existing rpmdb problem(s), 'yum check' output follows:
1:NetworkManager-glib-0.8.1-8.git20100831.fc13.i686 is a duplicate with 1:NetworkManager-glib-0.8.1-6.git20100831.fc13.i686
coreutils-8.4-9.fc13.i686 is a duplicate with coreutils-8.4-8.fc13.i686
coreutils-8.4-9.fc13.i686 has missing requires of coreutils-libs = ('0', '8.4', '9.fc13')
freetype-2.3.11-6.fc13.i686 is a duplicate with freetype-2.3.11-3.fc13.i686
1:java-1.6.0-openjdk-1.6.0.0-43.1.8.2.fc13.i686 is a duplicate with 1:java-1.6.0-openjdk-1.6.0.0-42.b18.fc13.i686
mysql-libs-5.1.51-2.fc13.i686 is a duplicate with mysql-libs-5.1.50-2.fc13.i686
poppler-0.12.4-6.fc13.i686 is a duplicate with poppler-0.12.4-5.fc13.i686
setroubleshoot-server-2.2.102-1.fc13.i686 is a duplicate with setroubleshoot-server-2.2.99-1.fc13.i686

解决方法是卸载错误的软件包,并重新更新

#以grub2为例
rpm -qa |grep grub2

grub2-2.02-0.33.el7.centos.1.x86_64
grub2-tools-2.02-0.33.el7.centos.1.x86_64

rpm -e grub2-2.02-0.33.el7.centos.1.x86_64
yum update