Dumb Linux trick:
Suspicious of damaged system files on an RHEL-like (rocky, alma, centos, probably fedora, whatever) system?
Once you get it unfucked enough to use the package manager (dealing with filesystem problems, hand-re-installing the rpms required to make dnf work, etc.) , systematically reinstall all installed packages!
As root do a: rpm -qa --queryformat "%{NAME}\n" > installed.txt
dnf reinstall $(<installed.txt)
and settle in for a long operation.
I’ve done it on Arch boxes where it is written as something like pacman -Qqn | pacman -S -
, but hadn’t tried it with dnf until I had a Rocky 8 box wedge during a dnf upgrade
yesterday and wipe out large pieces of the system, then cause some damage to the (annoying default XFS on LVM) root when a reboot failed. It seems to have worked.