百胜更新/安装任何软件包都会给我以下错误。我需要采取什么行动来克服这个问题?

百胜更新/安装任何软件包都会给我以下错误。我需要采取什么行动来克服这个问题?

百胜更新/安装任何软件包都会给我以下错误。我需要采取什么行动来克服这个问题?

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 267, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 120, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 432, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self,     self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 226, in doCommand
    return base.updatePkgs(extcmds)
  File "/usr/share/yum-cli/cli.py", line 736, in updatePkgs
    if not self.update(pattern=arg):
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 3687, in update
    obs_tups = self.up.obsoleted_dict.get(installed_pkg.pkgtup, [])
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 878, in     <lambda>
    up = property(fget=lambda self: self._getUpdates(),
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 702, in _getUpdates
    self._up = rpmUtils.updates.Updates(self.rpmdb.simplePkgList(), self.pkgSack.simplePkgList())
  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 489, in simplePkgList
    return self.pkglist
  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 232, in _get_pkglist
    csumpkgtups = self.preloadPackageChecksums(load_packages=False)
  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 966, in     preloadPackageChecksums
    rpmdbv = self.simpleVersion(main_only=True)[0]
  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 1149, in simpleVersion
    self._put_cached_simpleVersion_main(main)
  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 1098, in _put_cached_simpleVersion_main
    os.rename(rpmdbvfname + ".tmp", rpmdbvfname)
OSError: [Errno 5] Input/output error

答案1

您的情况恕我直言类似于中概述的情况 CentOS问题

所以解决方案可能是相同的:重新安装python,然后重新安装yum,然后执行yum clean all && yum makecache,然后执行yum update

答案2

重要的部分似乎是最后一行:

OSError: [Errno 5] Input/output error

这表示从底层存储介质(即硬盘)读取或写入数据时出现物理故障。

如果您运行,dmesg您可能会在最后找到一些进一步的诊断信息。

每当我遇到这个特定错误时,我就会立即对媒体产生怀疑。由于它可能是硬盘驱动器,因此您可能需要检查其 SMART 状态,例如:

smartctl -a /dev/sda

并检查是否有坏扇区:

badblocks /dev/sda

另请检查以确保驱动器电缆连接牢固并且电源供电充足。

相关内容