Red Hat Bugzilla – Bug 71683
Can't rebuild packages list (/var/lib/rpm).
Last modified: 2008-05-01 11:38:03 EDT
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 -- 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):
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
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
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
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.
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?
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.
I just wanted to thank you for your help, email@example.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.