1

A host crashed near the end of some package update, and now I have an inconsistency I'd like to fix:

rpm -Va complains about dependency packages would be missing, but those packages are installed!

However when I use rpm -qa package_name I see the same package being installed multiple times (e.g. three times).

When I try to remove the package using rpm -ve package_name, rpm tells me:

error: "package_name" specifies multiple packages:

But note that there is no output after the colon. So when listing the packages using rpm -qa package_name I get a list of three identical packages (same release, same version, same architecture). When I use the full package name for rpm -ve, I get the message about multiple packages again, but this time the full package names are listed.

How can I remove the duplicate packages in order to reinstall them cleanly?

rpm version is 4.14.3-150300.46.1.x86_64 of SLES 15 SP3

I had tried a rpm -v --rebuilddb already: It did not output anything, nor did it change anything.

4
  • The "solution" in unix.stackexchange.com/a/290906/320598 did not help.
    – U. Windl
    Commented Aug 17, 2022 at 9:24
  • @Mokubai I think the removed tags inconsistency (did not exist before) and duplicate were justified for this question.
    – U. Windl
    Commented Aug 17, 2022 at 10:08
  • They were both meta tags that provide nearly no information about the subject of your question. "Inconsistency" could be applied to any number of topics and does nothing to actually focus on any specific problem, it requires other tags to define what it is "inconsistent" with. Same with "duplicate". stackoverflow.blog/2010/08/07/the-death-of-meta-tags Tags should provide information on their own, not just raise more questions.
    – Mokubai
    Commented Aug 17, 2022 at 10:31
  • From What are tags, and how should I use them? "A tag is a word or phrase that describes the topic of the question." which Inconsistency does not do. Also "Do not use meta-tags in questions. Here are some tips to help you determine whether a tag is a meta-tag: If the tag can’t work as the only tag on a question, it’s probably a meta-tag."
    – Mokubai
    Commented Aug 17, 2022 at 10:39

1 Answer 1

0

Having configured automatic snapshots on BtrFS, I tried this:

  1. mkdir /var/lib/rpm/SAVED

  2. mv /var/lib/rpm/* /var/lib/rpm/SAVED/

  3. Use snapper list to find the most recent useful snapshot number. In my case it was 439.

  4. Copy the saved RPM database back to the system. After finding an empty /var in /.snapshots/439/snapshot/var, I realized that /var/lib/rpm is a symbolic link to ../../usr/lib/sysimage/rpm (i.e.: /usr/lib/sysimage/rpm (a stupid concept IMHO, BTW). So I used cp -a /.snapshots/439/snapshot/usr/lib/sysimage/rpm/* /var/lib/rpm/ to copy that part of the snapshot back into the system.

  5. Next I inspected /var/log/zypp/history to find the packages that were removed after the snapshot (the system thinks those packages are still there), so I reinstalled them to make the RPM database consistent with the files.

  6. Likewise I repeated the online updates (that may be in the filesystem, but not in the RPM database). Remember: That snapshot was taken before the failed updates, so the updates are not in the database.

  7. Eventually I ran rpm -Va to find suspect output that might require a reinstall of the package. It looked good however!

So it seems the whole issue was a damaged or inconsistent RPM database, but the problem was not detected by RPM itself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .