Sometime ago I managed to erase the /var/lib/rpm folder which basically contains information about all the rpms in the System
The problem posed is that I cannot query nor Upgrade using the yum
I did the steps mentioned like rpm --rebuild and ll that but it did not help
Its my pure curiosity to know of a method by which we can restore the database of the installed rpm's
I say curiosity, because the server runs fine without it also !!!
Hope no one does this anytime ... I lost many days sleep for this
Thanks in advance for reading this post and thinking of a solution
Regards
amRit
Your only chance, if this system is important enough, is to reinstall only to db:
You could use your /root/install.log and /var/log/yum.log to get a list of installed RPMs, or, if you have a similar system you could get the RPM list from there.
That said, if this system can suffer downtime, I'd suggest re-installing as the best way. Otherwise, see the comment above.
Best of luck
Edit: I read wrong -- if you removed the entire /var/lib/rpm directory you are a bit hosed.
You said you already did this first step, but for future reference (and for anyone else that runs into this)
delete
/var/lib/rpm/__db.*
then
rpmdb –rebuilddb
It's not really a big deal, your system isn't hosed. Just run the above command(s) and you should be back in business.
If you've kept a backup, then you might be able to restore it. Otherwise, you've wiped the only copy of the RPM database. (The
rpm --rebuilddb
command rebuilds some files in that directory from others.) Your system is basically hosed.I've never tried to, but you can try to set up a new empty RPM database (copy from fresh install?) and reinstall all currently installed packages in the current installed versions. You may have a look into your rpm (or maybe yum, if you're using it) logs to determine currently installed packages.