rpmdb: Thread/process failed: Thread died in Berkeley DB library

Posted by David Guillermo on Tuesday, January 14, 2020

Hoy vamos a ver como solucionar que se nos haya corrompido la Berkeley DB Library, de CentOS para poder actualizar los paquetes necesarios de nuestra distribución.

    root@symfony httpd # yum search mod_ssl
    rpmdb: Thread/process 31872/3077490368 failed: Thread died in Berkeley DB library
    error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
    error: cannot open Packages index using db3 -  (-30974)
    error: cannot open Packages database in /var/lib/rpm
    CRITICAL:yum.main:

Bueno una vez que tenemos eso, sólo nos queda hacer una copia por si acaso y regenerar la DB y lo haremos así:

    root@symfony httpd # mkdir rpm_backup
    root@symfony httpd # cd rpm_backup/
    root@symfony rpm_backup # cp -a /var/lib/rpm/__db* .

Una vez tenemos el backup, procedemos a limpiar,

    root@symfony rpm_backup # rm -f /var/lib/rpm/__db.00*
    root@symfony rpm_backup # rpm --quiet -qa
    root@symfony rpm_backup # rpm --rebuilddb
    root@symfony rpm_backup # yum clean all

cuando termine, realizamos una búsqueda para actualizar los repos y solucionado.

    root@symfony rpm_backup # yum search mod_ssl
    Loaded plugins: fastestmirror
    Determining fastest mirrors
    * PUIAS_6_computational: www.puias.princeton.edu
    * base: centos.cadt.com
    * extras: mirror.tedra.es
    * rpmforge: mirror.hmc.edu
    * updates: mirror.tedra.es
    * webtatic: sp.repo.webtatic.com

    PUIAS_6_computational              | 3.3 kB     00:00
    PUIAS_6_computational/primary_db   | 1.2 MB     00:01
    base                               | 3.7 kB     00:00
    base/primary_db                    | 3.7 MB     00:01
    extras                             | 3.3 kB     00:00
    extras/primary_db                  |  21 kB     00:00
    linuxtech                          | 2.6 kB     00:00
    linuxtech/primary_db               | 700 kB     00:00
    mondorescue                        | 2.9 kB     00:00
    mondorescue/primary_db             |  63 kB     00:00
    nginx                              | 2.9 kB     00:00
    nginx/primary_db                   |  33 kB     00:00
    nodesource                         | 2.5 kB     00:00
    nodesource/primary_db              |  28 kB     00:00
    rpmforge                           | 1.9 kB     00:00
    rpmforge/primary_db                | 2.8 MB     00:03
    scl_python27                       | 3.0 kB     00:00
    scl_python27/primary_db            |  30 kB     00:00
    slc6-devtoolset                    | 2.6 kB     00:00
    slc6-devtoolset/primary_db         | 163 kB     00:00
    updates                            | 3.4 kB     00:00
    updates/primary_db                 | 6.8 MB     00:00
    webtatic                           | 3.6 kB     00:00
    webtatic/primary_db                | 147 kB     00:00
    zabbix                             | 2.9 kB     00:00
    zabbix/primary_db                  | 114 kB     00:00
    zabbix-non-supported               |  951 B     00:00
    zabbix-non-supported/primary       | 3.8 kB     00:00
    zabbix-non-supported               15/15

    ================================================================= N/S Matched: mod_ssl ==================================================================

    mod_ssl.i686 : SSL/TLS module for the Apache HTTP Server

    Name and summary matches only, use "search all" for everything.

Y estaría solucionado.