📖 ~1 min read
Table of contents
Symptom & Impact
dnf hangs at rpmdb open
Environment & Reproduction
Power loss or filesystem rollback left BerkeleyDB rpmdb torn.
Root Cause Analysis
Stale __db.00X files prevent rpm and dnf from locking the database.
Quick Triage
rpm -qa hangs and ls /var/lib/rpm/.dbenv.lock exists.
Step-by-Step Diagnosis
Run: ls /var/lib/rpm; rpm –rebuilddb; dnf check.

Solution – Primary Fix
sudo rm /var/lib/rpm/__db.*; sudo rpm –rebuilddb; sudo dnf clean all; sudo dnf check.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Convert to sqlite backend with dnf-plugin-rpmdb-convert if supported.
Verification & Acceptance Criteria
dnf list installed returns immediately and dnf check reports no errors.
Rollback Plan
Restore /var/lib/rpm from snapshot or last backup.
Prevention & Hardening
Enable rpm autorebuild via daily cron with monitoring.
Related Errors & Cross-Refs
Pairs with rpmdb open failed and BDB recovery warnings.
Related tutorial: View the step-by-step tutorial for centos-stream-9.
View all centos-stream-9 tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
rpm and dnf admin docs.
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.