π ~1 min read
Table of contents
Symptom & Impact
Package operations fail globally, leaving systems unable to patch or install dependencies.
Environment & Reproduction
Usually follows power loss or forced termination during dnf transactions.
dnf check
rpm -qa | head
rpm --rebuilddb --help
Root Cause Analysis
Partial writes and lock-file leftovers can invalidate RPM metadata consistency.
Quick Triage
Confirm corruption and gather transaction history before changes.
dnf history
rpm -Va --nofiles --nodigest
ls -la /var/lib/rpm
Step-by-Step Diagnosis
Validate db file health and detect active lock contention.
fuser -v /var/lib/rpm/.rpm.lock || true
cp -a /var/lib/rpm /var/lib/rpm.backup
rpm -qa > /root/rpm-before.txt

Solution – Primary Fix
Rebuild RPM database and repair unresolved dependencies.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
dnf distro-sync -y

Solution – Alternative Approaches
Boot rescue mode for offline repair when rootfs inconsistencies persist.
dnf reinstall -y rpm dnf
dnf check
dnf upgrade --refresh -y
Verification & Acceptance Criteria
Package queries and upgrade transactions complete without db errors.
rpm -qa | wc -l
dnf check
journalctl -p err -n 50
Rollback Plan
Restore rpmdb backup if rebuild introduces unresolved package state.
rm -rf /var/lib/rpm
cp -a /var/lib/rpm.backup /var/lib/rpm
rpm --rebuilddb
Prevention & Hardening
Protect update windows with power safeguards and avoid abrupt transaction termination.
systemctl status dnf-automatic.timer
journalctl -u dnf-automatic --since yesterday
Related Errors & Cross-Refs
Often appears with filesystem corruption, low disk space, and SELinux relabel interruptions.
Related tutorial: View the step-by-step tutorial for rhel-10.
View all rhel-10 tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Red Hat guidance for RPM database recovery and package transaction troubleshooting.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.