更新或安装时出现 yum 错误

更新或安装时出现 yum 错误

我正在运行 centos 6.6 发行版,但我遇到了 yum 问题。例如,在更新或安装任何软件包时,我会遇到一些错误

百胜安装 nmap

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                   | 4.4 kB     00:00     
epel-source/metalink                                                                                                                            | 4.4 kB     00:00     
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 294, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 146, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 438, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 210, in doCommand
    return base.installPkgs(extcmds)
  File "/usr/share/yum-cli/cli.py", line 699, in installPkgs
    self.install(pattern=arg)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3513, in install
    mypkgs = self.pkgSack.returnPackages(patterns=pats,
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 906, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 686, in _getSacks
    self.repos.populateSack(which=repos)
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 290, in populateSack
    self.doSetup()
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 105, in doSetup
    self.ayum.plugins.run('postreposetup')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/fastestmirror.py", line 197, in postreposetup_hook
    if downgrade_ftp and _len_non_ftp(repo.urls) == 1:
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 701, in <lambda>
    urls = property(fget=lambda self: self._geturls(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 698, in _geturls
    self._baseurlSetup()
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 644, in _baseurlSetup
    mirrorurls.extend(list(self.metalink_data.urls()))
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 741, in <lambda>
    metalink_data = property(fget=lambda self: self._getMetalink(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 729, in _getMetalink
    shutil.move(result, self.metalink_filename)
  File "/usr/lib/python2.6/shutil.py", line 250, in move
    raise Error, "Destination path '%s' already exists" % real_dst
shutil.Error: Destination path '/var/cache/yum/i386/6/epel-source/metalink.xml/metalink.xml.tmp' already exists

tailf /var/log/消息

Mar 20 15:53:58 system2 abrt: detected unhandled Python exception in '/usr/bin/yum'
Mar 20 15:53:58 system2 abrtd: New client connected
Mar 20 15:53:58 system2 abrtd: Directory 'pyhook-2015-03-20-15:53:58-8635' creation detected
Mar 20 15:53:58 system2 abrt-server[8636]: Saved Python crash dump of pid 8635 to /var/spool/abrt/pyhook-2015-03-20-15:53:58-8635

自由-m

             total       used       free     shared    buffers     cached
Mem:          1883       1834         49        140         21        242
-/+ buffers/cache:       1570        313
Swap:         4031        486       3545

答案1

第二个错误(来自评论):数据库格式错误,应通过以下方式更正yum history new

sudo yum clean all
sudo yum history new

对于第一个错误,我只会删除整个缓存目录 ( /var/cache/yum/i386),因为 yum clean 不会删除导致错误的目录。 Yum 将重新下载它需要的内容。

相关内容