So this used to happen a lot... but since yum, not so much... Like an impatient admin, I got tired of waiting, so I tried to ctrl+c. What? you aren't going to listen? Okay, so I background it, and then kill it.

[root@core ~]# yum check-update
Loaded plugins: refresh-packagekit
dag                                                                                                                                             | 1.9 kB     00:00
dag/primary_db                                                                                                                                  | 7.1 MB     00:08
fedora/metalink                                                                                                                                 | 2.9 kB     00:00
mod-pagespeed                                                                                                                                   |    0 B     00:30 ...
http://dl.google.com/linux/mod-pagespeed/rpm/stable/i386/repodata/repomd.xml: [Errno 4] Socket Error: timed out
Trying other mirror.
updates/metalink                                                                                                                                | 2.6 kB     00:00
^Z
[1]+  Stopped                 yum check-update
[root@core ~]# killall -9 yum
[1]+  Killed                  yum check-update
[root@core ~]#

So then this leads to a corrupt rpm database. Well, I guess we just need to clean it right? I mean you were just running check-update.

[root@core yum.repos.d]# yum check-update
rpmdb: Thread/process 1673/3078575808 failed: Thread died in Berkeley DB library
error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
/usr/lib/python2.6/site-packages/yum/config.py:884: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  raise Errors.YumBaseError("Error: " + e.message)
CRITICAL:yum.main:

Error: rpmdb open failed

[root@core yum.repos.d]# yum clean all
rpmdb: Thread/process 1673/3078575808 failed: Thread died in Berkeley DB library
error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
/usr/lib/python2.6/site-packages/yum/config.py:884: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  raise Errors.YumBaseError("Error: " + e.message)
CRITICAL:yum.main:

Error: rpmdb open failed
[root@core yum.repos.d]#

Incorrect! Its a full blown corrupt rpmdb. So then we have to do it the old fashion way. We blow away the rpm database, and rebuild it. But! lets back it up first... just in case...

[root@core yum.repos.d]# cd /var/lib/
[root@core lib]# tar -cf rpm_backup.tar rpm
[root@core lib]#

Now, lets go ahead and rebuild the rpmdb:

[root@core lib]# rm -f /var/lib/rpm/__db.00*
[root@core lib]# rpm --rebuilddb
[root@core lib]#

Assuming everything worked out, you should now have a working rpmdb:

[root@core lib]# yum check-update  | head
 Loaded plugins: refresh-packagekit

atop.i386                                     1.25-1.el5.rf                  dag
awstats.noarch                                7.0-2.el5.rf                   dag
clamav-devel.i386                             0.97.5-2.el5.rf                dag
git.i386                                      1.7.11.1-1.el5.rf              dag
graphviz.i386                                 2.22.0-4.el5.rf                dag
graphviz-devel.i386                           2.22.0-4.el5.rf                dag
lame.i386                                     3.99.5-1.el5.rf                dag
lame-devel.i386                               3.99.5-1.el5.rf                dag
[root@core lib]#