Quote:
Originally Posted by xi_guadiy
/var/lib/rpm is exsit in my /var directory. That`s means all things under /var has deleted except /var/lib/rpm.
|
That's definately weird but OK...
Quote:
Originally Posted by xi_guadiy
__db.0001,__db.002,__db.0003,Packages,Providename
|
Cool. We only need the "Packages" file. The steps are below. Please remove outer single quotes before running commands and if you are not sure read the manual page for the command or ask BEFORE executing these steps.
1. The "__db.00" files are temporary files and should be deleted first: 'rm -f /var/lib/rpm/__db.00?'.
2. Test the RPM database to make sure we don't waste time: '/usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages || echo BAD && echo OK'.
3. If the database is OK make a list of files in /var: 'rpm -qa --dump|grep ^/var/|awk '{print $1}'|sort|uniq > /tmp/rpm_varfiles'.
4. Finds the RPM's that these files are in: 'cat /tmp/rpm_varfiles|while read file; do rpm -q --whatprovides "${file}"; done|sort|uniq > /tmp/rpm_varrpms'. You now have a file called "/tmp/rpm_varrpms" which contains the RPM's that should be restored. Now you have a choice:
A. You can choose to reinstall the RPM's. Pro: you can be sure all permissions are right and the RPM database is synced. Con: If you install a package that made changes in configuration files in /etc you will lose those changes. If there are not that many packages affected this may be your best choice.
B. You can choose to extract the RPM's contents to a safe directory, move the files in place and then fix the permissions. Con: it takes more steps, misses out on all things post-install scripts configure (unless you extract and run those too) and it isn't really "the RPM way". Pro: this is selective since you won't overwrite files.
I'd suggest you perform steps 1-4, tell us if all went OK, what the output of 'wc -l /tmp/rpm_varrpms' is and which path you choose.
And make sure you have all the install CDROMs ready.