Bug 71683 - Can't rebuild packages list (/var/lib/rpm).
Summary: Can't rebuild packages list (/var/lib/rpm).
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 7.1
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-08-16 17:10 UTC by David Evans
Modified: 2008-05-01 15:38 UTC (History)
0 users

Clone Of:
Last Closed: 2002-08-16 17:10:43 UTC

Attachments (Terms of Use)

Description David Evans 2002-08-16 17:10:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)

Description of problem:
At some point the /var/lib/rpm directory disappeared. I am not sure how it 
happened since the last change to system was done through up2date. I was told I 
could rebuild it with the following commands:

rpm --initdb
rpm -- rebuilddb

These only seem to work if the rpm directory is recreated. However, they pretty 
much built an empty packages list. The technician told me to submit a bug 
report since the behavior is not as expected. If you would like to see the 
ticket, it is number 211289.

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

How reproducible:

Steps to Reproduce:
1. Delete or move the /var/lib/rpm directory
2. cd /var/lib
3. mkdir rpm
4. rpm --initdb
5. rpm --rebuilddb

Additional info:

Comment 1 Jeff Johnson 2002-08-17 16:44:24 UTC
Yes. If /var/lib/rpm is entirely gone, then
--initdb and --rebuilddb can/will not recreate
the original contents.

Look in /var/log/rpmpkgs for the list of packages
that were installed on your system. Reinstall
those packages to recreate the database. Or, even
simpler, reinstall using anaconda to recreate
your database.

Comment 2 David Evans 2002-08-21 22:04:05 UTC
OK. All of the rpmpkgs log files have the error:

error: cannot open Packages index using db3 - No 
such file or directory (2)

However, the redhat network site still contains an updated 
package list. I am a little nervous about running anaconda since I have run up2date a couple of 
times since the system was installed. (In fact, I am still not convinced that up2date was not the 
culprit that wiped the rpm directory.) Is there a way I could push the package list down from the 
redhat network?

Comment 3 Jeff Johnson 2002-08-22 00:52:50 UTC
If all the rpmpkgs file have the error, then
/var/lib/rpm has been gone for a while.

Look at the file modify times to get an idea
how long /var/lib/rpm has been missing.

Anaconda (followed by running up2date) is
the easiest way to recreate the database.

If you thing up2date is the culprit (I don't FWIW),
then use the --download option, and install the
packages from /var/spool/up2date using rpm from
the command line. If you don't trust up2date even
that much, download and install the updates manually.

You can also get the package list by logging into
rhn.redhat.com and displaying the installed package list.

Comment 4 David Evans 2002-08-22 21:29:19 UTC
I am not sure if I am not abusing the system but it never hurts to ask. I tried 
to use anaconda --reconfig but it never loads/unloads packages. If I use 
anaconda --method cdrom:///mnt/cdrom it tells me I am stupid for running it on 
a live system. It seems as though I have to entirely reinstall to rebuild the 
packages using anaconda. Was there some other mode that you were thinking about?

Comment 5 Jeff Johnson 2002-08-22 21:33:15 UTC
Do a reinstall using anaconda, but do not
make a new file system on your disk partitions.

That's the easiest way to recreate the database
without losing any data.

Comment 6 David Evans 2002-08-27 16:21:12 UTC
I just wanted to thank you for your help, jbj@redhat.com. I ended up using the list of packages 
stored in the redhat network to create some shell scripts to reinstall the packages. Once the rpm 
database was rebuilt, I was able to run up2date with no problems. Thanks again.

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