Re: Restore RPM database?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: Restore RPM database?
On Sun, 2005-02-06 at 16:06 -0700, Alan Dayley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sunday 06 February 2005 12:29 pm, Craig White wrote:
> > > as a means of a bookmark - this may be of use to you but I think this is
> > > more to the point of - if normal methods of rebuilddb aren't going to
> > > work, this probably has the sort of info that you/we need...
> > >
> > > <http://www.redhat.com/archives/rpm-list/2002-March/msg00072.html>
> >
> > ----
> > One more step thru on this...probably a little more succinct...
> >
> >
> > Fix a hoarked rpm database
> >
> >     Symptom: All rpm commands "hang up"

> >
> >     Find and kill all processes running rpm or up2date:

> >
> >         ps ax | grep rpm
> >         ps ax | grep up2date

> >
> >         (Kill them by hand)

> >
> >     Remove all rpm database lock files:

> >
> >         rm -f /var/lib/rpm/__db*

> >
> >     This usually gets things going. If not:

> >
> >     First make a backup of the database:

> >
> >         cp -r /var/lib/rpm /var/lib/rpm.copy

> >
> >     Then rebuild the database

> >
> >         rpm --rebuilddb

> >
> >     This takes some time, but if it hangs forever, repeat
> >     the "Find and kill rpm" step and proceed with:

> >
> >         cd /var/lib/rpm
> >         db_verify Packages

> >
> >         (You may need to install db4-utils)

> >
> >     If db_verify reports errors, try:

> >
> >         cp Packages Packages.backup
> >         db_dump Packages.backup | db_load Packages
> >         rpm --rebuilddb

> >
> >     If all these steps fail, you are in big do-do.

>
> So, this is what it feels like to be in big do-do. ;^\

----
don't give me that much credit - I didn't write any to-do, I didn't even
know about the steps above - grabbed them off a site that I found from a
google search.
----
>
> Thanks for all the tips, Craig. Very helpful as usual!

----
always good to invest in my own learning here and I have learned a bunch
on your problem - better you than me ;-)
----
>
> All the suggestions you gave resulted in no change of the state of the rpm
> database. The computer thinks nothing is installed. Below is the output of
> the 'rpm --rebuild -vv' command but nothing there jumps out as a problem.

----
sure it does...you're just hoping for the big flag waving that says "FIX
ME" - the problem is seems obvious from what you have below
----
> Of course, in the back of my mind I am wondering how the in got in this state
> to begin with. I'll be doing a very thorough check of memory and the hard
> drive when I do the FC3 install this week.

----
always a good idea to format/bad block check - it just takes time ;-)

As for how it got this way? Who knows? Bad karma? Did you kick the
cat?

Did you run out of disk space on /var when doing some update?

Since Fedora uses sleepycat to manage the DB's here, did you do
something with DB4 like install a new version compiled from source or
something?
----
> 'rpm --rebuild -vv' command outputl, in case there is a hint here:
>
> # rpm --rebuilddb -vv
> D: rebuilding database /var/lib/rpm into /var/lib/rpmrebuilddb.16296
> D: creating directory /var/lib/rpmrebuilddb.16296
> D: opening old database with dbapi 3
> D: opening  db environment /var/lib/rpm/Packages create:cdb:mpool
> D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
> D: locked   db index       /var/lib/rpm/Packages
> D: opening new database with dbapi 3
> D: opening  db environment /var/lib/rpmrebuilddb.16296/Packages create:mpool
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Packages create 
> mode=0x42
> D:  read h#       2 Header sanity check: OK
> D:   +++ h#       1 Header sanity check: OK
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Name create mode=0x42
> D: adding "gpg-pubkey" to Name index.
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Group create mode=0x42
> D: adding "Public Keys" to Group index.
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Providename create 
> mode=0x42
> D: adding 2 entries to Providename index.
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Provideversion create 
> mode=0x42
> D: adding 2 entries to Provideversion index.
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Installtid create 
> mode=0x42
> D: adding 1 entries to Installtid index.
> D: opening  db index       /var/lib/rpmrebuilddb.16296/Pubkeys create 
> mode=0x42
> D: adding 1 entries to Pubkeys index.
> D:  read h#       1 Header sanity check: OK
> D:   +++ h#       2 Header sanity check: OK
> D: adding "gpg-pubkey" to Name index.
> D: adding "Public Keys" to Group index.
> D: adding 2 entries to Providename index.
> D: adding 2 entries to Provideversion index.
> D: adding 1 entries to Installtid index.
> D: adding 1 entries to Pubkeys index.
> D:  read h#       3 Header sanity check: OK
> D:   +++ h#       3 Header sanity check: OK
> D: adding "gpg-pubkey" to Name index.
> D: adding "Public Keys" to Group index.
> D: adding 2 entries to Providename index.
> D: adding 2 entries to Provideversion index.
> D: adding 1 entries to Installtid index.
> D: adding 1 entries to Pubkeys index.
> D: closed   db index       /var/lib/rpm/Packages
> D: closed   db environment /var/lib/rpm/Packages
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Pubkeys
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Installtid
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Provideversion
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Providename
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Group
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Name
> D: closed   db index       /var/lib/rpmrebuilddb.16296/Packages
> D: closed   db environment /var/lib/rpmrebuilddb.16296/Packages
> D: removing directory /var/lib/rpmrebuilddb.16296

----
the problem seems to be it didn't add any entries into 'Packages' as
this is in a temp folder called /var/lib/rpmbuilddb.16296/Packages
before it finishes.

you have to go through the steps listed...
----
> >    This usually gets things going. If not:

> >
> >     First make a backup of the database:

> >
> >         cp -r /var/lib/rpm /var/lib/rpm.copy

> >
> >         cd /var/lib/rpm
> >         db_verify Packages

> >
> >         (You may need to install db4-utils)

> >
> >     If db_verify reports errors, try:

> >
> >         cp Packages Packages.backup
> >         db_dump Packages.backup | db_load Packages
> >         rpm --rebuilddb

-----
seems as though you have nothing to lose here by trying the above - and
if that fails perhaps similar with the other db's but they seemed ok
about adding entries.

i.e.
cp Group Group.backup
db_dump Group | db_load Group

etc.

the command db_dump Packages > Packages.txt will create a large text
dump of what is in Packages but even on a working system, it's mostly
incomprehensible to me.

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss