For reference and completeness sake, one command that would be able to achieve what initially asked for would be something like this (quickly fiddled together, but it's working)
rpm -qf $(rpm -Va 2>&1 | grep -vE '^$|prelink:' | sed 's|.* /|/|') | sort -u
Here's a short explanation of the various parts:
rpm -Va 2>&1
Will run a complete verification on all packages currently installed / listed in rpm database. It will also redirect stderr to stdout, as here on my box some errors which are caused by prelink being enabled are reported as errors but we want them on stdout.
Attention: Needs to run as root to be able to check all files, permissions and owner/group.
grep -vE '^$|prelink:'
suppresses display of emtpy lines and such of the prelink errors (example of such an error:
prelink: /tmp/#prelink#.B14JBi: Recorded 10 dependencies, now seeing -1
)
sed 's|.* /|/|')
will filter the rpm -Va
output to only show filenames
rpm -qf $()
will query for all the obtained filenames in which package those are contained, and output the package name and version
| sort -u
will suppress duplicate package name/version combinations.
Altogether you will receive a list of packages which failed verification.
rpm -Va
might still show some unrelated issues, as it also checks dependencies between packages, which might need to be suppressed by adding --nodeps
.
yum reinstall $(rpm -qa --qf="%{N}-%{V}\n" | sort)