From Bugzilla Helper: User-Agent: Mozilla/4.78 [en] (X11; U; Linux 2.4.8-ac7 i686; Nav) Description of problem: I just upgraded rpm to the latest version from up2date and it corrupted my db. I don't have any __db* (I removed them after reading the bug reports). And when I try rpm --rebuilddb I get a seg fault Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. rpm -qa or rpm --rebuilddb 2. segmentation fault Additional info:
Pointer (i.e. URL, bugzilla attachments won't work) to a copy of your database cd /var/lib tar czvf /tmp/rpmdb3-52470.tar.gz rpm please.
Ok, first at the of the update (I was updating rpms from up2date), I got these error messages: error: db3 error(-30998) from db->close: DB_INCOMPLETE: Cache flush was unable to complete error: db3 error(-30986) from db->verify: DB_VERIFY_BAD: Database verification failed For the link: http://mchouque.free.fr/rpmdb3-52470.tar.gz
We (Red Hat) should try to fix this before next release.
Hmmm your database is badly hosed, checked by (you need db3-utils) cd /var/lib/rpm db_verify Packages The 1st step is to attempt to repair using db_dump cd /var/lib/rpm mv Packages Packages-ORIG db_dump Packages-ORIG | db_load Packages Nope, db_dump just runs forever ... The next step is to try rpm --rebuilddb. Nope, that triggers a segfault while trying to access a header w/o RPMTAG_NAME, very much a "can't happen" condition. OK, another sanity check added when accessing headers gets a little farther, but there's yet another "can't happen" segfault later on. So, I'd suggest looking for /var/log/rpmpkgs*, if cron has run an rpm query, the names of the package files should be there. If you have the list of packages, you can recreate the database by doing cd /var/lib mv rpm rpm-ORIG mkdir rpm rpm --initdb for pkg in <list of packages here> do rpm -i --justdb --noscripts --notriggers --nodeps $pkg done
I had the same message on roswell (redhat release 7.1.93). To sum up: no rpm version after rpm-4.0.3-0.88 is usable for me. I first noticed this after installing rpm-4.0.3-0.79 (since it had integrated perl-Perl-RPM which was broken by newer rpm versions for a long time) on a fairly default redhat 7.1 system: db3 error(-30998) from db->close: DB_INCOMPLETE: Cache flush was unable to complete Tried a newer rpm 0.83, same, newer db3, same, and at some point the `segfault on headerFree' bug hit me and rpm would stop on `memory allocation failed' on all queries that included those records. I then tried rpm-4.0.3-0.88 but that only worsened things: 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) on everything .. So I rpm2cpio-d the rpm-4.0.2 packages and after discovering the # undo db1 configuration rm -f /etc/rpm/macros.db1 was able to use rpm again. It turned out that the rpm database had been corrupted. I was able to iteratively recover it by doing `db3_dump -p Packages' and (in vi) deleting the corrupted entries which I found by taking the next record after rpm -qa SEGV-d, and then db3_load-ing it again etc. One week later I installed a totally different system *from scratch* using roswell: ftp.du.se/pub/redhat/redhat/linux/beta/roswell/en/iso/i386/roswell-i386-disc?.iso Then *used* rpm to upgraded some *normal packages* (i.e. nothing related to rpm, db3, glibc etc.) and soon had exactly the same `..DB_INCOMPLETE: Cache flush ...' error. This time I found the newer rpm-4.0.3-0.91 on a mirror. It had fixes for at least the header corruption problem so tried that. After that again every rpm operation fails with: 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) Same for rpm-4.0.3-0.93 which I found some hours ago today. I suspect this is related to the build time db3/db.h having DB_VERSION_PATCH 11 but haven't yet found where the 4 comes from. What makes all this very messy is that it is quite hard to have different versions of rpm on the same system It used to be as simple as having /bin/rpm-2.1 and /bin/rpm-2.2.4 or whatever the versions where. Nowadays it involves /usr/lib/rpm/rpm{?,db}, macro files, rcfiles, /usr/lib/libdb* (db1, db2, db31, db3-3.2 and db3-3.3 in rpm sources), /usr/lib/librpm* LD_LIBRARY_PATH, making everything (e.g. --dbpath, -r, --rcfile ) `invalid argument's if you forget one thing. chroot to another partition having a non-broken rpm and using rpm -r also doesn't work. Documentation is the source code afaik ... For a program that is so pivotal to the redhat distributions I find this a very strange state of affairs.
Yeah, I figured out my db was bad... ;-( I'll try tonight the recovery trick (fortunately I have a rpmpkgs in my log directory).
If you have trouble recreating your database, I might be able to recover some -> most of your Packages file for you this weekend. Reopen this bug if you need help.