Database disk image is malformed in

I am getting the following traceback when trying to update my system:

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/", line 191, in user_main
    errcode = main(args)
  File "/usr/lib/python3.7/site-packages/dnf/cli/", line 65, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.7/site-packages/dnf/cli/", line 98, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.7/site-packages/dnf/cli/", line 122, in cli_run
    ret = resolving(cli, base)
  File "/usr/lib/python3.7/site-packages/dnf/cli/", line 158, in resolving
  File "/usr/lib/python3.7/site-packages/dnf/", line 753, in resolve
    self._transaction = self._goal2transaction(goal)
  File "/usr/lib/python3.7/site-packages/dnf/", line 674, in _goal2transaction
    ts.add_upgrade(pkg, upgraded, obs)
  File "/usr/lib/python3.7/site-packages/dnf/db/", line 278, in add_upgrade
    ti_new =, libdnf.transaction.TransactionItemAction_UPGRADE)
  File "/usr/lib/python3.7/site-packages/dnf/db/", line 227, in new
    reason = self.get_reason(pkg)
  File "/usr/lib/python3.7/site-packages/dnf/db/", line 242, in get_reason
    return self.history.swdb.resolveRPMTransactionItemReason(, pkg.arch, -1)
  File "/usr/lib64/python3.7/site-packages/libdnf/", line 792, in resolveRPMTransactionItemReason
    return _transaction.Swdb_resolveRPMTransactionItemReason(self, name, arch, maxTransactionId)
RuntimeError: Step: database disk image is malformed in

            ti.action as action,
            ti.reason as reason
            trans_item ti
            trans t ON ti.trans_id =
            rpm i USING (item_id)
            t.state = 1
            /* see comment in TransactionItem.hpp - TransactionItemAction */
            AND ti.action not in (3, 5, 7, 10)
            AND = 'pcre2'
            AND i.arch = 'i686'
        ORDER BY
            ti.trans_id DESC
        LIMIT 1

I’ve visited a few sites which tell to do this:

yum clean dbcache 

And above command also doesn’t solve the problem, this:

yum clean all
yum clean metadata
yum clean dbcache
yum makecache

Both the methods have not worked out for me. I was planning to upgrade to 31 after the update.

The reason maybe full out of space in root /, check it.

This is a well know ISSUE, reported before in RedHat Bugzilla: , dumping and undumping , clean dnf


I might have stumbled upon those tickets already while researching. But the problem doesn’t seem to be of disk space.

Removing the history SQLite file forces in creation of a new file. This solves the problem.

rm /var/lib/dnf/history.sqlite

You might consider renaming/backup it instead in case of failure.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.