RPM Database broken

Matthew Saltzman mjs at ces.clemson.edu
Thu Oct 20 21:01:42 UTC 2005


On Thu, 20 Oct 2005, Francois Massonneau wrote:

> On Thursday 20 October 2005 13:58, Matthew Saltzman wrote:
>
> Hello,
>
>> If you ran rpm --initdb (as you indicated in another post), then you
>> completely emptied your RPM DB.
>
> Yes, I understood that but it  was too late ;-(
>
>> Do you have /var/log/rpmpkgs*?  If so, you could try the following:
>
> Yes, I have five files, as rpmpkgs rpmpkgs.1 rpmpkgs.2 rpmpkgs.3 and
> rpmpkgs.4
>
>> (1) Download a complete set of RPMs listed in your last good rpmpkgs log
>> and place them in a directory.
>
> Yes what among those five files is the good one ? Do they include the same
> files listing ?? Do I have to copy/ paste them to form a single huge file ?

A dump of the RPM db is done nightly, overwriting /var/log/rmppkgs.  The 
logs are rotated weekly, and the digit at the end increases as the logs 
get older.  So rpmpkgs is the result of the last time cron.daily was run, 
rpmpkgs.1 is up to a week old, etc.

If rpmpkgs still has a complete listing of your system's RPMs, then it's 
the one to use.  If it's empty (or if it was generated after you did the 
steps you describe below) then you'll the next older one, plus a list of 
any updates or changes you made later.

> I ask you that, because while reading different posts, I found a script
> someone wrote that automate the process to build a new database based on
> those files you add to form a single file.
> I can post it in case this could be use by someone, but on my side, I don't
> know how to use it. Maybe just to run it, with as parameter the name of
> that rpmpkgs file ..? but see below
>
>> (2) Create a script that, for each file in /var/log/rpmpkgs, executes
>>
>>  	rpm -U --justdb <filename>
>>
>> (3) If you hadn't added, deleted, or updated any RPMs since the date of
>> the log file you used, you should be done.  Otherwise, add, delete, or
>> update the remaining packages by hand using the --justdb option.
>>
>> Maybe somebody could suggest a shortcut.  I don't know if yum can help
>> here or not.
>
> I did differently, but I would like to have your advices/opinions on that :
> I have another computer at home which has approximatively the same packages
> as my laptop (the one on which i have those pbs). I zipped all files I had
> in the /var/lib/rpm directory on my home computer, copied them on my
> laptop, unzipped them in my laptop:/var/lib/rpm directory, and run against
> them rpm -vv --rebuilddb.
> It seems it works again.
> Was I right or not ??
> Thank you. Francois

It's not perfect, but it's probably a start.  You now may want to run

 	rpm -va

to verify all the packages.  See the rpm man page to interpret the output. 
If you find significant errors, it may indicate (1) an RPM in the database 
but not installed; (2) an rpm with a different version installed than the 
one in the database.  In those cases, you might want to remove from the db 
or reinstall the RPMs in question.  If you have RPMs that are installed 
but not in the database, then you'll want to add them by hand.

I don't see why that wouldn't get you back working (except for possible 
mistakes...).  Does anyone else?

>
>

-- 
 		Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs




More information about the fedora-list mailing list