Bug 121509 - rpmdb messed up after update, rebuilddb segfaults
rpmdb messed up after update, rebuilddb segfaults
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
rawhide
i586 Linux
medium Severity high
: ---
: ---
Assigned To: Jeff Johnson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-22 04:04 EDT by Philipp Berndt
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-04-23 13:30:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Philipp Berndt 2004-04-22 04:04:52 EDT
Description of problem:
After updating with up2date (which it aborted due to insufficient 
disk space) a lot of packages (probably those which were subject to 
update) are now unknown to rpm, although their files still exist (i.
e. all of kde). Trying to rebuilddb fails with sefault, too.

Version-Release number of selected component (if applicable):
[root@deepthought rpm]# rpm --version
RPM version 4.3.1

How reproducible:
root@deepthought root]# up2date
[... aborts due to insufficient space ...]

root@deepthought root]# rpm -qf /usr/bin/kdeinit
file /usr/bin/kdeinit is not owned by any package
[root@deepthought root]# rpm -qf /usr/bin/locate
file /usr/bin/locate is not owned by any package

[root@deepthought root]# rpm -qa
[...]
Segmentation fault

[root@deepthought lib]# cd /var/lib/
[root@deepthought lib]# rsync -av ./rpm/. ./rpm-backup/.

[root@deepthought lib]# rpm --rebuilddb
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
[...]
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
Segmentation fault


[root@deepthought lib]# rsync -var rpm-backup/ rpm/
building file list ... done

wrote 448 bytes  read 20 bytes  936.00 bytes/sec
total size is 73687040  speedup is 157450.94
[root@deepthought lib]# cd /var/lib/rpm
[root@deepthought rpm]# mv Packages Packages-ORIG
[root@deepthought rpm]# /usr/lib/rpm/rpmdb_dump Packages-ORIG | 
/usr/lib/rpm/rpmdb_load Packages

root@deepthought rpm]# rpm -qa
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
tzdata-2003d-2
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
cracklib-2.7-27.1
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
raidtools-1.00.3-8
[...]
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
pciutils-devel-2.1.99.test3-1.1
error: rpmdbNextIterator: skipping h#     522 Header V3 DSA 
signature: BAD, key ID 30c9ecf8
krbafs-devel-1.2.2-2.1
Segmentation fault

Is there anything else I can do (besides reinstalling from scratch) ?
Comment 1 Jeff Johnson 2004-04-22 07:58:54 EDT
Sure, most of your rpmdb can prolly be saved.

Make a tar ball of /var/lib/rpm first.

Then try
     cd /var/lib/rpm
     rm -f __db*
     /usr/lib/rpm/rpmdb_verify Packages
What does rpmdb_verify report?

Comment 2 Philipp Berndt 2004-04-22 16:21:21 EDT
[root@deepthought rpm]# /usr/lib/rpm/rpmdb_verify Packages
[root@deepthought rpm]# echo $?
0
Comment 3 Jeff Johnson 2004-04-22 19:39:19 EDT
OK. try
    cd /var/lib/rpm
    rm __db*
    rm Pubkeys
    rpm -qavv
What does that do?

If that "works", rpm --rebuilddb -vv is next to try.
Comment 4 Philipp Berndt 2004-04-23 04:49:58 EDT
Both rpm commands completed with no errors (and no segfaults).
(Tell me if you need the logs.)
Feels much better now, thanks!

Do you have a suggestion on what to do with the lots of files
"not owned by any package" ?

Should I --replacefiles install the updates and later delete all 
files that are still not owned by any package?

Comment 5 Jeff Johnson 2004-04-23 13:30:34 EDT
Lots of files not owned is (probably) from header loss,
certainly header loss if rpm --rebuilddb was run with signature
checking (because pubkey imported) enabled, headers are discarded
if the signature (or digest) does not verify.

Yes, readding the packages that contain the unowned
files is the fix. Adding --replacefiles will save you
some work, but you may lose custom configuration.

Seems like you're well underway, so I'm gonna close this
bug. Fell free to reopen if you need more.

Note You need to log in before you can comment on or make changes to this bug.