As a normal user, I can do:
[agrajag@loiosh agrajag]$ rpm -qf /bin/bash
However, as root I get:
[root@loiosh agrajag]# rpm -qf /bin/bash
rpmdb: Program version 3.3.11 doesn't match environment version 3.3.4
error: db3 error(22) from dbenv->open: Invalid argument
error: cannot open Packages index using db3 - Invalid argument (22)
I get the same error when I try any rpm query command as root, such as a
-qa, or a normal '-q packagename'
rm -f /var/lib/rpm/__db*
Reopen this bug if that doesn't work.
That *mostly* works.. When I run 'rpm -qa' as root, it gets to:
[root@loiosh agrajag]# rpm -qa
Then it just hangs until I hit ^C. When I run rpm -qa as a normal user, it
seems to print all the rpms and exit cleanly.
[root@loiosh agrajag]# rpm -q rpm
The next step is
I ran rpm --rebuilddb as root, and it just sat there.. no heavy disk access or
anything... at the suggestion of Jeremy Katz, I straced it, found it was just
doing selects, then stopped the rpm process and did the rm -f /var/lib/rpm/__db*
*again*. Now everything seems to be working fine as far as I can tell..
however I do think it is a bug that I even had to remove these files once.
Fixed in rtpm-4.0.3-0.88.