[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: SUG: Automatic RPM database verification and repair Tony Nelson Wed Nov 29 18:05:36 2006

At 7:27 AM -0500 11/29/06, Jeff Johnson wrote:
>On Nov 28, 2006, at 11:33 PM, Tony Nelson wrote:
>> I haven't seen this come through.
>> At 3:19 PM +0800 11/27/06, Nerazzurri wrote:
>>>> None of the above should be considered criticism, just history.
>>>> There are two needs if one wants to protect against rpmdb data loss.
>>>>The most important is saving a copy of /var/lib/rpm/Packages routinely.
>>>>All other information in an rpmdb can be regenerated from a reasonably
>>>>recent copy of Packages. And in most cases a depsolver like
>>>>yum/smart/apt/poldek will reinstall the packages that have changed
>>>>since the last copy of Packages was saved.
>>>but how can i know which version of "/var/lib/rpm/Packages" is correct
>>>and work well, if i backup a corrupted "Packages", the backup work will
>>>be senseless, isnt it? :-)
>>The "right" way would be to make a copy of the Packages file, check it,
>>and only save it if the check passes. According to Jeff, the proper check
>>is to do a "rpm --rebuilddb" with that Packages file and see if it works,
>>but I haven't tried that method.
>Sorry for not replying.

No, I didn't see my own post come through, so I don't know how anyone could
have replied.

>Doing --rebuildib is not the "proper" check,

How do I get --rebuilddb to tell me if there are problems with my RPM database?

>nor is --rebuilddb the   only check.

So far you have mentioned only --verifydb, which does a check, and
--rebuilddb, which does not check the existing database, but ony attempts
to build a new database from the Packages file.  What other check is there?

>What I tried to say is
>     1) Doing --verifydb does not verify the data in an rpmdb, but
>     only verifies the Berkeley DB structural elements.
>     2) All the essential data is in Packages, the indices can be
>     rebuilt by --rebuilddbwhenever needed.
>     3) The integrity of headers contained in Packages is verfied
>     when the headeris read from an rpmdb.

Yes, you said that, and I understood it.  Since RPM normally uses the other
files, their integrity is important for normal use.  "rpm --verifydb"
checks the format of those files.  "rpm --rebuilddb" replaces them without
checking them.  Apparently nothing checks their referential integrity, so
the best available check is "rpm --verifydb".  Is there any check that can
determine that --rebuilddb is needed, other than either --verifydb or rpm

>There are very few cases of damaged headers in Packages that have been
>reported to me in the last 2 years, none that were not easily detectable
>and fixed.

Normally very few bugs get reported at all.  Most people using Fedora don't
report bugs, and don't use even fedora-list.  Newcomers to fedora-list
frequently say it is too much trouble when asked to file a bug report, and
then they go away again.  The lack of new bug reports is mild reassurance.

I may have been using a "broken" RPM database for quite a while before my
attempt to upgrade FC5 to FC6 failed because of it.  Many operations on the
RPM database still worked (e.ge. yum updates and installs).  Only fiddling
around with the "problem" package caused errors from RPM, though "rpm
--verifydb" also reported the errors.  I don't really know if the damage to
the RPM database had any real affect (until the failed upgrade), and it
would be very hard to find out.  Thus, even I did not report such a
problem, until now.  For most users, if an upgrade to FCx fails, they will
do a fresh install of some OS, possibly Fedora, and never report anything.
Therefore there can be errors in the RPM database that aren't in the
Packages file and that can be detected by "rpm --verifydb"; see RH BZ
215127 for possibly two examples.

Running "rpm --rebuilddb" does not diagnose errors in the RPM database, as
it replaces the old indices without checking whether they were wrong.

As you believe that "rpm --verfiydb" will not help anyone, I understand
that you will not be documenting it or encouraging the checking of users'
RPM databases.  As I think that there are corrupt RPM databases out there,
I will promote my rpm_vefifydb package on fedora-devel-list and
fedora-list.  You may chime in there if you wish to correct any perceived
misinformation I am promoting.
TonyN.:'    The Great Writ     <mailto:[EMAIL PROTECTED]>
      '      is no more.             <http://www.georgeanelson.com/>

Rpm-list mailing list