π ~1 min read
Table of contents
Symptom & Impact
dnf and rpm operations fail, blocking installations and updates.
Environment & Reproduction
Usually follows interrupted package transactions or abrupt power loss.
dnf list installed
rpm -qa | head
Root Cause Analysis
RPM database files are inconsistent and cannot be read reliably by the package manager.
Quick Triage
Check rpmdb access and lock files.
ls -l /var/lib/rpm
fuser -v /var/lib/rpm/*
Step-by-Step Diagnosis
Validate database state and capture errors in logs.
rpm --verifydb
journalctl -p err -g rpm --since '2 hours ago'

Solution – Primary Fix
Backup and rebuild the RPM database, then retry transaction.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo cp -a /var/lib/rpm /var/lib/rpm.bak.$(date +%F)
sudo rpm --rebuilddb
sudo dnf clean all

Solution – Alternative Approaches
Restore from known-good snapshot if rebuild does not recover package state.
Verification & Acceptance Criteria
rpm query and dnf update both execute without database errors.
rpm -qa | wc -l
dnf check
Rollback Plan
Revert /var/lib/rpm from backup if rebuild introduces inconsistencies.
sudo rm -rf /var/lib/rpm
sudo mv /var/lib/rpm.bak. /var/lib/rpm
Prevention & Hardening
Avoid forced power-offs during updates and use transactional maintenance windows.
Related Errors & Cross-Refs
Related to database lock contention and failed post-transaction scripts.
Related tutorial: View the step-by-step tutorial for oracle-linux-10.
View all oracle-linux-10 tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
RPM database maintenance and recovery procedures for enterprise Linux.
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.