Fedora 31 dnf 无法安装软件包

Fedora 31 dnf 无法安装软件包

我正在使用 Fedora 31。当我尝试使用 dnf 安装某些东西时,我不断收到错误。例如,当我运行时sudo dnf install -y balena-etcher-electron它说:

Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 191, in user_main
    errcode = main(args)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 65, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 98, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 122, in cli_run
    ret = resolving(cli, base)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 166, in resolving
    base.do_transaction(display=displays)
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 243, in do_transaction
    tid = super(BaseCli, self).do_transaction(display)
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 882, in do_transaction
    tid = self._run_transaction(cb=cb)
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 954, in _run_transaction
    tid = self.history.beg(rpmdbv, using_pkgs, [], cmdline)
  File "/usr/lib/python3.7/site-packages/dnf/db/history.py", line 456, in beg
    int(misc.getloginuid())
  File "/usr/lib64/python3.7/site-packages/libdnf/transaction.py", line 641, in beginTransaction
    return _transaction.Swdb_beginTransaction(self, dtBegin, rpmdbVersionBegin, cmdline, userId)
RuntimeError: Step: database disk image is malformed in
INSERT INTO   rpm VALUES   (2560, 'balena-etcher-electron', 0, '1.5.76', '1', 'x86_64')

造成这种情况的原因是什么以及如何解决它?

答案1

大多数时候dnf upgrade失败是因为已安装的软件包和要安装的软件包之间或要安装的软件包之间存在冲突。检查它抱怨哪些文件,rpm -qf TheOffendingFile提供带有该文件的(当前)包。看看该怎么做,删除那个,--exclude升级时发生什么冲突(可能必须排除几个)。不同架构(例如 x86_64 和 i686)的相同软件包之间的冲突很常见......

损坏的数据库可以经常可以用 来修复rpm --rebuilddb,而不是经常破坏数据库本身。

相关内容