There’s a bug in rpm on Red Hat Enterprise Linux as well as some versions of CentOS Stream that can stop packages from installing. (Convenient, right?) You’ll see messages such as signature hdr data BAD when trying to upgrade packages via dnf.

This is how I ended up solving it:

  • I’d try to upgrade rpm in place via dnf using dnf upgrade rpm. This would fail, but it would cache the packages.
  • Note the path to the cached packages. On my system, it was /var/cache/dnf/baseos-9a27fc7471a8d219/packages/, but yours may vary.
  • Use rpm to force install the rpm and rpm-libs packages:
    • rpm -i --force /var/cache/dnf/baseos-9a27fc7471a8d219/packages/rpm-4.14.3-26.el8.x86_64.rpm
    • rpm -i --force /var/cache/dnf/baseos-9a27fc7471a8d219/packages/rpm-libs-4.14.3-26.el8.x86_64.rpm
  • Then, try your dnf install or dnf upgrade procedure again, and it should be fine.