SO I had an engineer build a server and try to rsync some data to it before lighting it up. Problem is, he rsynced the entire /var partition, which included the RPM database. Now the new system thinks it has all the stuff installed on it that the old system doesn’t. Dilemma….
So I wrote a quick script to remove the “missing” packages from the rpm db.
#!/usr/bin/perl
open (RPMPIPE,"rpm -qa |");
while (
$package=$_;
chomp $package;
print “Package: $package “;
$missing=`rpm –verify $package | grep ‘missing’`;
if ($missing) {
print “might be missing…\n”;
$verify=`rpm –verify $package`;
print “\n$verify\n\n”;
} else {
print “\n”;
};
};
Note that this code doesn’t automatically assume the package is actually missing. It’s quite possible that you have deleted one or more files which belong to a package, in which case you might not want to assume the package is missing.
If you determine that a package is indeed missing, just issue the following to get rid of it.
rpm --nodeps --justdb packagename
0 Responses to “Cleaning out missing packages from RPM db”