Ask Your Question
1

How do I overcome these DNF and RPM errors?

asked 2015-07-01 09:58:41 -0600

updated 2016-02-13 19:04:03 -0600

mether gravatar image

I have an installation of Fedora 22 on a removable hard disk drive (HDD) (that I always run via USB link to the same computer, if you're wondering) that used to work fine until recently (keeping in mind while it's about a week ago, it is recent to me as I only use this OS once a week or fortnight or so) when I received errors described in this question. These errors appear to be gone now but now I am getting the following errors from running sudo dnf install terminator:

error: db5 error(-30973) from dbenv->open: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
warning: /var/cache/dnf/i386/22/fedora/packages/terminator-0.97-6.fc21.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 8e1431d5: NOKEY
error: db5 error(-30973) from dbenv->open: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
error: db5 error(-30973) from dbenv->open: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 185, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 141, in _main
    ret = resolving(cli, base)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 160, in resolving
    base.do_transaction()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 216, in do_transaction
    self.gpgsigcheck(downloadpkgs)
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 249, in gpgsigcheck
    self.getKeyForPackage(po, fn)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 1742, in getKeyForPackage
    if misc.keyInstalled(ts, info.rpm_id, info.timestamp) >= 0:
  File "/usr/lib/python2.7/site-packages/dnf/yum/misc.py", line 285, in keyInstalled
    for hdr in ts.dbMatch('name', 'gpg-pubkey'):
  File "/usr/lib/python2.7/site-packages/dnf/rpm/transaction.py", line 58, in dbMatch
    mi = self.ts.dbMatch(*args, **kwds)
_rpm.error: rpmdb open failed

Now these are just lines of output from this command that appeared to be errors to me (although they did all appear in exactly that order in the terminal, with no missing lines if you're wondering) the full output is VERY LONG and is here. If the output of the commands free -h and uname -r are still relevant (as was mentioned in the linked question) here they are:

free -h:

              total        used        free      shared  buff/cache   available
Mem:           3.7G        755M        2.2G        134M        820M        2.8G
Swap:          3.0G          0B        3.0G

uname -r:

4.0.4-303.fc22.i686+PAE
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-07-01 10:37:03 -0600

geforce gravatar image

Delete the corrupt db then build a new one.

su
rm -rf /var/lib/rpm/__db.00*
rpmdb --rebuilddb
edit flag offensive delete link more

Comments

1

That final line gave the error: `error: rpmdb: BDB0058 page 45535: illegal page type or format error: rpmdb: BDB0061 PANIC: Invalid argument error: rpmdb: BDB3016 Packages: pgin failed for page 45535 error: db5 error(-30973) from dbcursor->c_get: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: rpmdb: BDB0060 PANIC: fatal region error detected; run recovery error: db5 error(-30973) from dbcursor->c_close: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: rpmdb: BDB0060 PANIC: fatal region error detected; run recovery error: db5 error(-30973) from db->close: BDB

Brenton Horne gravatar imageBrenton Horne ( 2015-07-01 10:43:45 -0600 )edit
1

Try this and post any errors

su
rpm --rebuilddb
geforce gravatar imagegeforce ( 2015-07-01 11:37:27 -0600 )edit

No errors came out of this command, but running sudo dnf install terminator (no longer as root) afterwards gives: Config error: releasever not given and can not be detected from the installroot.

Brenton Horne gravatar imageBrenton Horne ( 2015-07-01 11:39:33 -0600 )edit
1

Try this to see if it helps

su
dnf --releasever 22 reinstall fedora-release
geforce gravatar imagegeforce ( 2015-07-01 12:43:32 -0600 )edit

That gave this error: Failed to synchronize cache for repo 'helber-atom' from 'https://copr-be.cloud.fedoraproject.org/results/helber/atom/fedora-22-i386/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried, disabling. Last metadata expiration check performed 5:07:24 ago on Thu Jul 2 00:32:45 2015. No match for argument: fedora-release Error: Nothing to do.

Brenton Horne gravatar imageBrenton Horne ( 2015-07-01 14:41:04 -0600 )edit
0

answered 2016-11-15 12:49:05 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

The above answer does not work on Fedora 24 docker because fedora 24 docker does not grant the root user permission to delete the corrupted databases.

[root@fd1a23f35367 rpm]# ls -l
total 10780
-rw-r--r--. 1 root root  778240 Jun 14 16:21 Basenames
-rw-r--r--. 1 root root    8192 Jun 14 16:21 Conflictname
-rw-r--r--. 1 root root  192512 Jun 14 16:21 Dirnames
-rw-r--r--. 1 root root    8192 Jun 14 16:20 Enhancename
-rw-r--r--. 1 root root    8192 Jun 14 16:21 Filetriggername
-rw-r--r--. 1 root root    8192 Jun 14 16:23 Group
-rw-r--r--. 1 root root   12288 Jun 14 16:23 Installtid
-rw-r--r--. 1 root root   16384 Jun 14 16:23 Name
-rw-r--r--. 1 root root    8192 Jun 14 16:21 Obsoletename
-rw-r--r--. 1 root root 8052736 Jun 14 16:23 Packages
-rw-r--r--. 1 root root   86016 Jun 14 16:23 Providename
-rw-r--r--. 1 root root    8192 Jun 14 16:21 Recommendname
-rw-r--r--. 1 root root   81920 Jun 14 16:21 Requirename
-rw-r--r--. 1 root root   24576 Jun 14 16:23 Sha1header
-rw-r--r--. 1 root root   16384 Jun 14 16:21 Sigmd5
-rw-r--r--. 1 root root    8192 Jun 14 16:20 Suggestname
-rw-r--r--. 1 root root    8192 Jun 14 16:20 Supplementname
-rw-r--r--. 1 root root    8192 Jun 14 16:21 Transfiletriggername
-rw-r--r--. 1 root root    8192 Jun 14 16:21 Triggername
-rw-r--r--. 1 root root  286720 Jun 14 16:23 __db.001
-rw-r--r--. 1 root root   90112 Jun 14 16:23 __db.002
-rw-r--r--. 1 root root 1318912 Jun 14 16:23 __db.003
[root@fd1a23f35367 rpm]# pwd 
/var/lib/rpm
[root@fd1a23f35367 rpm]# rm __db.001
rm: remove regular file '__db.001'? y
rm: cannot remove '__db.001': Operation not permitted
[root@fd1a23f35367 rpm]#

The simple fix is remove fedora and install linux mint.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-07-01 09:58:41 -0600

Seen: 8,577 times

Last updated: Jul 01 '15