Following an unclean shutdown and a colourful fsck, a whole bunch of files have gone missing. The output of 'rpm -Va' is several hundred lines long (mostly missing files but also some checksum and other mismatches). Is there an easy way to reinstall packages which have missing and/or corrupt files?

The OS in question is Fedora 22.

  • 4
    Certainly possible, but also pretty tedious to parse the output and for each file query the package which contains that file and probably takes some time. Why not simply reinstall all packages? yum reinstall $(rpm -qa --qf="%{N}-%{V}\n" | sort)
    – doktor5000
    Jul 19, 2015 at 12:48
  • It might also be pretty ugly to filter out all the additional issues caused by prelink, if I'm not mistaken that is still enabled by default on Fedora according to fedorahosted.org/fesco/ticket/1183
    – doktor5000
    Jul 19, 2015 at 12:59
  • I did indeed end up reinstalling everything - the problem was that I had forgotten to enable keep-cache for dnf, it ended up downloading over 2gb of packages (and I have capped internet) Jul 19, 2015 at 13:05

3 Answers 3


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.

  • 1
    I get : sudo: unable to execute /bin/rpm: Argument list too long Nov 14, 2021 at 17:49
  • su root beforehand solved it... Nov 14, 2021 at 18:05

I recently had a similar problem with missing files on openSUSE 13.2 and fixed it with:

rpm -Va --nodeps --nodigest --noscripts --nosignature --nofiledigest --nosize --nomode --nordev --nouser --nogroup --nomtime\
| awk -e '($1=="missing") && ($2=="d") {system("rpm -qf "$3);}; ($1=="missing") && ($2!="d") && ($2!="c") {system("rpm -qf "$2);}'\
| sort -u | xargs zypper in -f

The options to rpm and the call to awk are intended to save time in my case, because no corruption occurred.

  • 1
    If there has been no file corruption, you could even add --nofiles and hence basically do the same as yum check dependencies as it will only check all installed rpm packages for dependency issues. --nofiles would save a lot of time for non-SSD installations, but you would also omit the check for files that are missing. ... just for completeness sake. And please keep in mind, if you grep for english strings, you might want to prefix with LC_ALL=C ;)
    – doktor5000
    Aug 15, 2015 at 19:13

I had a same issue on CentOS 7 and achieve to fix it with a little custom of the @auxsvr answer's :

rpm -Va --nodeps --nodigest --noscripts --nosignature --nofiledigest --nosize --nomode --nordev --nouser --nogroup --nomtime |egrep 'manque|missing' |awk '$2=="d"{print "rpm -qf "$3}' |sh  |sort -u |xargs yum -y reinstall

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.