1st. Thanks in advance.

This is somewhat like # 216697: Reinstalling packages with missing/corrupt files except in that person's situation, after recovery, the system still worked. Mine does not. Can't start X, no networking, systemd doesn't have all it's requirements so services can't start, etc etc. The system, to use the technical term, is hosed. (Fedora 26 i686)

DNF has an --installroot command, and if I boot to a LiveUSB OS, I can mount my root filesystem partition and do dnf --installroot=/run/media/liveuser/sda6/ repolist and it does list all my configured repos. I further try dnf --installroot=/run/media/liveuser/sda6/ list --all and hundreds of package names scroll past. I am assuming the DNF db or rpmdb or whatever (I really don't know, sorry) seems intact.

While DNF allows me to work with the non-running system, I can't figure out how to use RPM -V on a non-running system. It seems to only deal with the live OS. I assume I can chroot trick it, but don't want to risk messing up anything so I'm asking and googling madly, trying to find a solution to just verify the install and only force reinstall the corrupted packages, but am coming up empty.

As a last resort, I'm going to use dnf --installroot={path} reinstall * but that will incur many hours of time and a many gigabytes to be wastefully downloaded. At least it can happen unattended. Alternatively I could keep using the liveOS and wait another week or two and install Fedora 27 over my disabled system when it's released, but that seems just as big a cop-out as force reinstalling every package. I really would love to learn how to do this.

RPM Ninjas: HELP!

  • I don't know rpm-based distros very well, but what I would do: 1) I would "install" the required packages with extracting them with rpm2cpio into the root, until the system becomes bootable again 2) then I would use some forced rpm/yum install tricks to install them again, this time correctly.
    – peterh
    Sep 27, 2017 at 19:02
  • If the packages were installed at one point but files were manually deleted or whatever, then your rpm dbis probably OK. So I'd convert the rpm files to tgz files using alien and then simply boot with some media and extract the tar files.
    – ivanivan
    Sep 27, 2017 at 22:49

1 Answer 1


It seems like you are simply looking for the rpm --root option, which is roughly analogous to dnf --installroot. This is documented in the RPM man page:

   --root DIRECTORY
          Use the file system tree rooted at DIRECTORY for all operations.
          Note that this means the database within DIRECTORY will be  used
          for  dependency  checks  and  any  scriptlet(s)  (e.g.  %post if
          installing, or %prep if building, a package) will be run after a
          chroot(2) to DIRECTORY.

To verify all packages installed onto a filesystem mounted at /run/media/liveuser/sda6/, run something like:

  rpm --root /run/media/liveuser/sda6/ -Va
  • you nailed it. --root. Bravo. Sadly it doesn't actually help me, as, it only verifies if any of the file specs have changed; utime, size, perms, context, etc. So for the truncated inodes that got deleted, it shows a "missing:" entry... but it does nothing to verify corrupted files or linked to empty space. I need a checksum, and I don't think that is part of the RPM spec, only the sig of the entire payload not each component. Oh well. But you did answer what I asked, so thanks for that! Sep 28, 2017 at 10:42
  • @BobLovesYou Actually, that's not the case. Each file has a hash ("digest") stored, and that is verified with -V. It's a shasum now, but historically it was an md5sum, and a failure will show up in the verify results as a 5 in the third column. If you see a . there, that checksum passed. If you see a ? there, it's because the file couldn't be read for some reason (permissions, usually — like if you're running as non-root).
    – mattdm
    Sep 28, 2017 at 13:37
  • Are you sure you are not having a different problem? What if you boot in SELinux permissive mode?
    – mattdm
    Sep 28, 2017 at 13:38

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.