Lots of folks are seeing this so I thought I would through this out here. This can also be found in the Red Hat Knowledgebase:
Why does the Red Hat Update Agent (up2date) return the error 'rpmdb: Program version 4.2 doesn't match environment version' after updating my Red Hat Enterprise Linux 3 machine to Update 4?
Release Found: Red Hat Enterprise Linux 3 Update 4
This would occur in systems which are set to automatically update using up2date. You get the following error after updating Red Hat Enterprise Linux 3 machine to Update 4:
rpmdb: Program version 4.2 doesn't match environment version
error: db4 error(22) from dbenv->open: Invalid argument
error: cannot open Packages index using db3 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm
This is a bug, which has been observed after the release of Update 4 for Red Hat Enterprise Linux 3. Red Hat is aware of the problem and we are working to resolve it. To get information related to this bug or to submit additional details to it, see bug 143532 in Bugzilla.
Workaround: The less invasive way to resolve this problem is to reboot your system. If you can not reboot your system or if a reboot does not resolve the issue, the following should work.
To fix this issue and to allow the updates to continue, remove all files starting with __db in /var/lib/rpm directory.
# rm -rf /var/lib/rpm/__db*
Note: Before executing this command ensure that rpm, rpmq, up2date or rhnsd processes are not running.
The problem is caused by an incompatibility to the RPM database. You can rebuild your RPM database with the following command (after you remove the /var/lib/rpm/__db* files):
This article is protected by the Open Publication License, V1.0 or later http://www.opencontent.org/openpub/
Copyright © 2003-2005 by Red Hat, Inc.