Bug 124069 - rpm database get corrupted and rpm -qa segfaults after 2 days
Summary: rpm database get corrupted and rpm -qa segfaults after 2 days
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm   
(Show other bugs)
Version: 2
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-05-23 19:40 UTC by Eric Ross
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-30 03:51:28 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Eric Ross 2004-05-23 19:40:08 UTC
Description of problem:
After 2 days, using rpm fails. I installed apt from fedora.us. It
worked fine, but after a while I started to get:


X:/var/lib/rpm# rpm -q rpm
....
apt-0.5.15cnc6-0.fdr.11.2
error: rpmdbNextIterator: skipping h#95050028 blob size(11): BAD, 8 +
16 * il(1703125084) + dl(551531384)
error: rpmdbNextIterator: skipping h#      17 blob size(11): BAD, 8 +
16 * il(1963020689) + dl(-1489727999)
error: rpmdbNextIterator: skipping h#1802246941 blob size(11): BAD, 8
+ 16 * il(91) + dl(100663297)
error: rpmdbNextIterator: skipping h#27036381 blob size(11): BAD, 8 +
16 * il(1440309175) + dl(-389703461)
error: rpmdbNextIterator: skipping h#16777216 blob size(11): BAD, 8 +
16 * il(-7441621) + dl(1313669385)
Segmentation fault


X:/var/lib/rpm# rm __db.00*; rpm --rebuilddb -vv
...
D:  read h#     745 Header V3 DSA signature: NOKEY, key ID 8df56d05
D:   +++ h#     381 Header V3 DSA signature: NOKEY, key ID 8df56d05
D: adding "apt" to Name index.
D: adding 115 entries to Basenames index.
D: adding "System Environment/Base" to Group index.
D: adding 43 entries to Requirename index.
D: adding 3 entries to Providename index.
D: adding 36 entries to Dirnames index.
D: adding 43 entries to Requireversion index.
D: adding 3 entries to Provideversion index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "de70b6edd5e25cec8a62de3c14f7a683cb6b8170" to Sha1header index.
D: adding 115 entries to Filemd5s index.
error: rpmdbNextIterator: skipping h#95050028 blob size(11): BAD, 8 +
16 * il(1703125084) + dl(551531384)
error: rpmdbNextIterator: skipping h#      17 blob size(11): BAD, 8 +
16 * il(1963020689) + dl(-1489727999)
error: rpmdbNextIterator: skipping h#1802246941 blob size(11): BAD, 8
+ 16 * il(91) + dl(100663297)
error: rpmdbNextIterator: skipping h#27036381 blob size(11): BAD, 8 +
16 * il(1440309175) + dl(-389703461)
error: rpmdbNextIterator: skipping h#16777216 blob size(11): BAD, 8 +
16 * il(-7441621) + dl(1313669385)
Segmentation fault

X:/var/lib/rpm# rm __db.00*; mv Pubkeys Pubkeys.old; rpm --rebuilddb -vv
[same as before]

When I try to dump the Packages file:
X:/var/lib/rpm# /usr/lib/rpm/rpmdb_dump Packages
VERSION=3
format=bytevalue
type=hash
db_dump: DB->stat: DB_PAGE_NOTFOUND: Requested page not found


Version-Release number of selected component (if applicable):
rpm-4.3.1-0.3


Additional info:

Every time I get the error, rpm start to eat memory. I see the memory
indicator in gkrellm and when rpm is about to segfaul, free memory
it's almost empty and the kernel start to swapping to disk.

Comment 1 Eric Ross 2004-05-23 19:50:40 UTC
Ups.. 'rpm -q rpm' is really 'rpm -qa'

Comment 2 Jeff Johnson 2004-05-24 14:50:15 UTC
What does the following say?
     rm -f /var/lib/rpm/__db*
    /usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages


Comment 3 Eric Ross 2004-05-24 15:12:42 UTC
X:/var/lib/rpm# rm -f /var/lib/rpm/__db*; /usr/lib/rpm/rpmdb_verify 
/var/lib/rpm/Packages
db_verify: Page 4019: item 0 has bad type
db_verify: DB->verify: /var/lib/rpm/Packages: DB_VERIFY_BAD: Database
verification failed

Comment 4 Jeff Johnson 2004-05-25 13:31:03 UTC
OK. You need to do the following:

    cd /var/lib/rpm
    mv Packages Packages-ORIG
    /usr/lib/rpm/rpmdb_dump Packages-ORIG | /usr/lib/rpm/rpmdb_load
Packages
    rpm --rebuilddb -vv

Does that fix?

Comment 5 Eric Ross 2004-05-25 16:57:59 UTC
X:/var/lib/rpm# mv Packages Packages-ORIG
X:/var/lib/rpm# /usr/lib/rpm/rpmdb_dump Packages-ORIG |
/usr/lib/rpm/rpmdb_load Packages
db_dump: DB->stat: DB_PAGE_NOTFOUND: Requested page not found
db_load: line 4: unexpected format

[In my first post I wrote about dumping the packages file]

Comment 6 Jeff Johnson 2004-05-27 00:25:32 UTC
Do
    rm -f /var/lib/rpm/__db*
to avoid DB_PAGE_NOTFOUND.

Comment 7 Eric Ross 2004-05-27 01:00:59 UTC
Ok.. here we go, in one line:

X:/var/lib/rpm# rm -f __db*; \
mv Packages Packages-ORIG;\
/usr/lib/rpm/rpmdb_dump Packages-ORIG | /usr/lib/rpm/rpmdb_load Packages
db_dump: DB->stat: DB_PAGE_NOTFOUND: Requested page not found
db_load: line 4: unexpected format

Comment 8 Jeff Johnson 2004-05-29 13:29:47 UTC
Please give me a ptr (i.e. URL, bugzilla attachments won't work)
to a tarball of your rpmdb:
    cd /var/lib
    tar czvf /tmp/rpmdb-124069.tar.gz
and I'll take a look. No promises, an rpmdb that
rpmdb_dump cannot read may not be savable.

Comment 9 Eric Ross 2004-05-29 19:18:25 UTC
I put it here:
http://vipnova.cl/~eross/rpmdb-124069.tar.bz2

I hope it's still savable.

Comment 10 Jeff Johnson 2004-05-30 00:14:50 UTC
Hmmm, your rpmdb like nothing I've ever seen.

Adding -r to rpmdb_dump into rpmdb_load generates a Packages
file that passes rpmdb_verify. Unfortunately, not enough.

Adding -rp to rpmdb_dump, and examining the printed output,
shows SElinux file contexts that (afaict) should not be
there. How that info got there is a mystery to me, but I
don't believe I can edit the rpmdb_dump output suffciently
to recreate an rpmdb.

So let's try plan B:

Look at /var/log/rpmpkgs*. That should be the list of
pkgs that you had installed.

Download a copy of those (or equivalent) pkg (that's the hard part).

Rename the existing /var/lib/rpm, make a new /var/lib/rpm.

Reinstall each of those packages with the flags
    rpm -Uvh --justdb --noscripts --notriggers
to recreate your database.

When finished, rpm -Va should identify any/all mistakes.

Add a comment here if you need help.

Comment 11 Eric Ross 2004-05-30 03:11:36 UTC
Thank you. I follow your instructions, and my rpm db is alive again. I
found no big troubles with -Va.
I didnt found references to using --justdb and friends when I searched
before posting here. I think it's a good method (if you have an
updated rpmpkgs).

Thank you again.


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