How does --rebuilddb work when the db is completely unreadable?

Stuart D. Gathman stuart at gathman.org
Fri Jan 20 19:57:06 UTC 2017


On Fri, 20 Jan 2017, John Walker wrote:

> > It reads the data records, ignoring any indexes, and creates a new
> > database from scratch.  While reading the data records, it discards
> > those that fail basic sanity checks.
> 
> I'm new to rpm internals.  When you say it reads the data records, which data records
> do you mean?  Records from the berkley database named "Packages?"  Records from several
> of the databases in the rpm database directory?  Something else entirely?  

Records from all files in the berkley database.  Most ISAMs
(indexed sequential access method), keep the raw data records in a
simple sequential format.  While interrupting updates may corrupt the
indexes, the data records are a dirt simple format like a text file
or psacct data.  In other database formats, it is possible to read the
database files sequentially (using read(2), *not* using the db access
libraries), extracting raw records which are tagged in each block for
extraction independent of the indexing.

> I feel like I'm misunderstanding something here, because if a rebuild must be able to
> read records from the current database, it wouldn't do much good if the current database
> is unreadable, however, I have found that rpm --rebuilddb does work when the

By "unreadable" do you mean that copying the database files with 'cp'
fails with an ioerr?  Or just that libdbX is unable to open and/or
read the database files?

-- 
 	      Stuart D. Gathman <stuart at gathman.org>
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


More information about the Rpm-list mailing list