Skip to content
Ercan Ermis
Ercan Ermis

notes for everyone about cloud technology

  • Cloud
    • AWS
    • GCP
  • Container
    • Kubernetes
    • Docker
  • Linux
  • DevOps
  • Privacy Policy
  • Contact
Ercan Ermis

notes for everyone about cloud technology

Fix “Error: rpmdb open failed” on CentOS or Amazon Linux 2

Ercan, April 20, 2020April 24, 2021

Yesterday, I have started to test some services on running Amazon Linux 2 powered by Amazon Web Services cloud. For some reason, my package manager yum is broken and when I started to update my yum database, I’ve got an error about rpmdb open failed. You can see my error below. If you are running on Centos7 or another Linux distro using the package manager as yum, you can also continue to read.

error: rpmdb: BDB0113 Thread/process 18275/140171317404864 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed

I decided to move all rpm database packages to /tmp directory.

sudo mv /var/lib/rpm/__db* /tmp

After this movement, yum should be clean completely. I run “yum clean all” to clean my yum database.

sudo yum clean all

After the cleaning process, yum said to me, cleaning is done.

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Repository elastic-7.x is listed more than once in the configuration
Bad id for repo: root@ip-11-12-30-149 yum.repos.d, byte = @ 4
Cleaning repos: amzn2-core amzn2extra-epel elastic-7.x epel treasuredata
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos

I crossed my fingers and tried to update my yum database with the latest versions of packages. For this; I run “sudo yum update” command.

sudo yum update

Now, yum is running perfectly again!

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Repository elastic-7.x is listed more than once in the configuration
Bad id for repo: root@ip-11-12-30-149 yum.repos.d, byte = @ 4
amzn2-core                                                                      | 2.4 kB  00:00:00
amzn2extra-epel                                                                 | 1.3 kB  00:00:00
elastic-7.x                                                                     | 1.3 kB  00:00:00
epel/x86_64/metalink                                                            |  21 kB  00:00:00
epel                                                                            | 4.7 kB  00:00:00
treasuredata                                                                    | 2.9 kB  00:00:00
(1/9): amzn2-core/2/x86_64/group_gz                                             | 2.5 kB  00:00:00
(2/9): amzn2-core/2/x86_64/updateinfo                                           | 200 kB  00:00:00
(3/9): amzn2extra-epel/2/x86_64/primary_db                                      | 1.8 kB  00:00:00
(4/9): elastic-7.x/primary                                                      | 115 kB  00:00:00
(5/9): epel/x86_64/group_gz                                                     |  95 kB  00:00:00
(6/9): epel/x86_64/updateinfo                                                   | 1.0 MB  00:00:00
(7/9): epel/x86_64/primary_db                                                   | 6.8 MB  00:00:00
(8/9): amzn2-core/2/x86_64/primary_db                                           |  39 MB  00:00:00
(9/9): treasuredata/2/x86_64/primary_db                                         |  15 kB  00:00:00
elastic-7.x                                                                                315/315
192 packages excluded due to repository priority protections
No packages marked for update

If you having rpmdb issues with your yum, you can easily follow the same steps and fix your package manager in a minute.

Share on Social Media
x facebook linkedin reddit
AWS amazon linux 2centospackage managerrpmyum

Post navigation

Previous post
Next post
  • AWS (45)
    • Serverless (4)
  • Best (9)
  • DevOps (16)
  • Docker (10)
  • GCP (3)
  • Kubernetes (3)
  • Linux (13)
  • Uncategorized (6)

Recent Posts

  • Automating AWS CloudWatch Log Group Tagging with Python and Boto3
  • Automating AWS ECR Tagging with Python and Boto3
  • Automating ECR Image Cleanup with Bash
  • Update ECR Repositories with Bash Script
  • Why Automated Tests Are Essential in Your CI/CD Pipeline and Development Flow
  • Streamline Your AWS ECR Management with This Powerful Bash Script
  • Setting up DKIM for Google Workspace (Gmail) using Terraform and AWS Route 53
  • Automate AWS Site-to-Site VPN Monitoring
  • Optimizing Docker Images: Tips for Reducing Image Size and Build Time
  • Monitoring EC2 Disk Space with a Simple Bash Script and Slack Alerts
  • Securing Docker Containers: Best Practices for Container Security
  • Mastering Dockerfile: Writing Efficient, Scalable Container Builds
  • Migrating a Git Repository from GitLab to GitHub with GPG-Signed Commits
  • Accessing AWS Services in Private Subnets Without 0.0.0.0/0
  • Understanding AWS Regions, Availability Zones, and VPCs: A Comprehensive Guide
©2025 Ercan Ermis | WordPress Theme by SuperbThemes