Bug 129599 - rpm database corrupted
Summary: rpm database corrupted
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: rpm
Version: 3.0
Hardware: i686
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-08-10 19:41 UTC by Cindy Wang
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-10 20:59:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Cindy Wang 2004-08-10 19:41:25 UTC
Description of problem:

rpm -qa only shows 71 packages are installed on this system, which 
does not seem to be correct.  Removed *db* from /var/lib/rpm 
directory and rebuild database using rpm --rebuilddb.  rpm -qa still 
returns with 71 packages.  

Tried /usr/lib/rpm/rpmdb_loadcvt, got the following:  

Converting to db-4.1.25 compatible format (1-10 minutes per file) ...
 /var/lib/rpm/Basenames: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Conflictname: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Dirnames: Berkeley DB (Btree, version 9, native byte-
order)
 /var/lib/rpm/Filemd5s: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Group: Berkeley DB (Hash, version 8, native byte-order)
 /var/lib/rpm/Installtid: Berkeley DB (Btree, version 9, native byte-
order)
 /var/lib/rpm/Name: Berkeley DB (Hash, version 8, native byte-order)
 /var/lib/rpm/Packages: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Packages-ORIG: Berkeley DB (Hash, version 8, native 
byte-order)
 /var/lib/rpm/Providename: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Provideversion: Berkeley DB (Btree, version 9, native 
byte-order)
 /var/lib/rpm/Pubkeys: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Requirename: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Requireversion: Berkeley DB (Btree, version 9, native 
byte-order)
 /var/lib/rpm/Sha1header: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/Sigmd5: Berkeley DB (Hash, version 8, native byte-order)
 /var/lib/rpm/Triggername: Berkeley DB (Hash, version 8, native byte-
order)
 /var/lib/rpm/__db.001: can't stat `/var/lib/rpm/__db.001' (No such 
file or directory).
db_dump: open: /var/lib/rpm/__db.001: No such file or directory
/bin/mv: cannot stat `/var/lib/rpm/__db.001': No such file or 
directory
/bin/mv: cannot stat `/var/lib/rpm/__db.001-N': No such file or 
directory
 /var/lib/rpm/__db.002: can't stat `/var/lib/rpm/__db.002' (No such 
file or directory).
db_dump: open: /var/lib/rpm/__db.002: No such file or directory
/bin/mv: cannot stat `/var/lib/rpm/__db.002': No such file or 
directory
/bin/mv: cannot stat `/var/lib/rpm/__db.002-N': No such file or 
directory
 /var/lib/rpm/__db.003: can't stat `/var/lib/rpm/__db.003' (No such 
file or directory).
db_dump: open: /var/lib/rpm/__db.003: No such file or directory
/bin/mv: cannot stat `/var/lib/rpm/__db.003': No such file or 
directory
/bin/mv: cannot stat `/var/lib/rpm/__db.003-N': No such file or 
directory
Done!

Please help.

Thanks.
Cindy

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


How reproducible:


Steps to Reproduce:
1. rm /var/lib/rpm/*db*
2. rpm -vv --rebuilddb
3. rpm -qa
  
Actual results:
rpm -qa returns with same number of packages installed as before 
performing the steps.

Expected results:
rpm database should rebuild with correct number of packages that are 
actually installed on this system. 

Additional info:

Comment 1 Jeff Johnson 2004-08-10 20:59:42 UTC
I see no "corruption" in your report.

I do see that there appear to be only 71 packages installed.
I have no idea why you blame that on "corruption".
I'd guess that 71 packages should be approx a 3-5 MB
/var/lib/rpm/Packages file. Verify by doing
    ls -l /var/lib/rpm/Packages
If the file size is less than 10 MB, then there are probably,
indeed, only 71 packages there.

rpmdb_loadcvt is probably not the tool you need.

Look at /var/log/rpmpkgs*, that is a log file that
should contain what packages were installed.

Download and reinstall packages that you are missing
will fix.

Comment 2 Cindy Wang 2004-08-10 21:38:41 UTC
The system originally has more than 400 packages installed.  One day 
while I tried to run rpm -qa, it returned back with only 71 
packages.  I tried to rebuild the rpm database and only 71 packages 
got to the databases.  Compares between the two rpmpkgs* files, there 
is a huge difference on the numbers.  

st-lnx08.peoplesoft.com:# cat rpmpkgs |wc -l
     71
st-lnx08.peoplesoft.com:# cat rpmpkgs.4 | wc -l
    494
st-lnx08.peoplesoft.com:# ls -ld rpmpkgs rpmpkgs.4
-rw-r--r--    1 root     root         2098 Aug 10 04:02 rpmpkgs
-rw-r--r--    1 root     root        13913 Jul 17 04:02 rpmpkgs.4

I certainly hope this is not a bug and there is a fix for it.  If you 
know of any resolutions to fix this problem, it will be greatly 
appreciated.  Please feel free to contact me if there are any 
questions or further information is required. 

Regards,
Cindy


Comment 3 Cindy Wang 2004-08-12 17:07:34 UTC
I found the following to re-create rpm db:

	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

When I tried the steps, I am getting:

error: open of zsh-4.0.7-1.i386.rpm failed: No such file or directory

Anything I have done incorrectly?  Can you help?

Thank you very much for your time.

Regards,

Cindy


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