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

看起来 RPM 数据库已损坏。请尝试rpm --rebuilddb

相关内容