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

Stuart D. Gathman stuart at
Fri Jan 20 00:24:40 UTC 2017

On Thu, 19 Jan 2017, John Walker wrote:

> I'm troubleshooting a problem with rpm 4.11.3.  I'd like to know a bit more about what
> --rebuilddb actually does.  From the source(
> 41), it looks like it just checks each entry in the package database to make sure it has
> certain fields.
> From its behavior though, I suspect it is doing more.  For example, I can run rpm
> --dbpath <old_rpm_db> --rebuilddb on a db-created by rpm 4.8, which is a db4 format and
> completely unreadable to rpm 4.11.  Somehow, in this situation, rpm 4.11 will produce a
> new (but inaccurate) db.  
> If anyone can give me any insight about how rpm rebuilds its database, or point me to
> relevant portions of the source, I would appreciate it.  

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.

 	      Stuart D. Gathman <stuart at>
"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