Yum fatal error run database recovery

I'm trying to run yum update and I'm running this error: rpmdb: PANIC: fatal region error detected; run recovery error: db3 error(-30974) from dbenv->open: DB_RUNRECOVERY: Fatal error, run data...

I’m trying to run yum update and I’m running this error:

rpmdb: PANIC: fatal region error detected; run recovery
error: db3 error(-30974) from dbenv->open: 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:

Error: rpmdb open failed

I checked page like this one but running yum clean all runs the same error.

How can I solve this?

asked Apr 25, 2015 at 15:40

Alex Jolig's user avatar

1

This is how I fixed my problem.

You may fix this by cleaning out rpm database. But first, in order to minimize the risk, make sure you create a backup of files in /var/lib/rpm/ using cp command:

mkdir /root/backups.rpm.mm_dd_yyyy/
cp -avr /var/lib/rpm/ /root/backups.rpm.mm_dd_yyyy/

The try this to fix this problem:

# rm -f /var/lib/rpm/__db*
# db_verify /var/lib/rpm/Packages
# rpm --rebuilddb
# yum clean all

And finally verify that error has gone with the following yum command

# yum update

answered Apr 25, 2015 at 15:40

Alex Jolig's user avatar

Alex JoligAlex Jolig

2,2193 gold badges14 silver badges19 bronze badges

7

All I had to do was to delete the two file with the «.lock» extension, and the three files that started with «__db».

# rm /var/lib/rpm/.dbenv.lock
# rm /var/lib/rpm/.rpm.lock
# rm /var/lib/rpm/__db*

After that, yum update worked.

answered Jan 17, 2019 at 19:00

isapir's user avatar

isapirisapir

3983 silver badges11 bronze badges

Thanks Alex, your answer worked for me apart from one slight change I had to make.

rm -f /var/lib/rpm/__db*

returned errors

rm: cannot remove `/var/lib/rpm/__db.001': Is a directory
rm: cannot remove `/var/lib/rpm/__db.002': Is a directory
rm: cannot remove `/var/lib/rpm/__db.004': Is a directory

so I had to recurse with

rm -rf /var/lib/rpm/__db*

answered Jun 6, 2015 at 20:18

Ian Ellis's user avatar

1

I tried the above one it did’nt work

below works fine

# cd /var/lib
# tar -zcvf /var/preserve/rpmdb-$(date +%Y-%m-%d_%H-%M-%S).tar.gz rpm

Note: This tar backup can be used if the attempt to recover the RPM database has issues.

Verify integrity of the Packages file:

# cd /var/lib/rpm
# rm -f __db*      # to avoid stale locks
# /usr/lib/rpm/rpmdb_verify Packages

# mv Packages Packages.orig
# /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages


# rpm -vv --rebuilddb

Once again verify RPM database:

# cd /var/lib/rpm
# /usr/lib/rpm/rpmdb_verify Packages

answered Apr 16, 2018 at 7:30

AReddy's user avatar

AReddyAReddy

3,0545 gold badges34 silver badges70 bronze badges

2

Содержание

  1. Как перестроить поломанную базу RPM
  2. DB_RUNRECOVERY: Fatal error, run database recovery:
  3. How to Solve Error Message error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery when running yum command
  4. Introduction
  5. Error Appearance
  6. Error Trigger
  7. Solution
  8. setaOffice

Как перестроить поломанную базу RPM

Так случилось, что в определенный момент база RPM на одном из серверов повредилась, нельзя было удалить или установить пакеты с помощью пакетного менеджера yum, постоянно сыпались ошибки.

Как исправить базу RPM читайте ниже…

Исходные данные: ОС Oracle Linux 7;
Задач: Исправить ошибки в базе RPM

При попытке вызвать yum repolist как и любую другую команду получаем ошибку:

Очевидно, что база RPM была повреждена и ее нужно восстановить.

1. Делаем копию базы на случай не успешной операции восстановления

2. Удаляем все файлы вида __db.XXX

3. Попробуем проверить базу

В ответ получаем ошибку:

4. Попробуем выгрузить старую базу в новый файл (dump -> load):

Увы, но результат тот же — ошибка

Если бы ошибки не было и операция dump -> load выполнилась успешно, то нужно было бы запустить rpmdb_verify для проверки корректности базы, например так:

, а далее проверить результат работы команды

если не будет ошибок, то база успешно отремонтирована, но у нас ошибка при операции dump -> load, поэтому попробуем пересоздать базу RPM.

5. Пересоздаем базу RPM

Результат работы с флагом —rebuilddb довольно большой, я приведу только начало вывода и конец:

Теперь проверим базу:

Попробуем получить список пакетов:

Все успешно, ошибок нет.

В будущем для проверки и ремонта базы RPM можно использовать утилиту dcrpm.

На этом все, до скорых встреч. Если у Вас возникли вопросы или Вы хотите чтобы я помог Вам, то Вы всегда можете связаться со мной разными доступными способами.

Источник

DB_RUNRECOVERY: Fatal error, run database recovery:

I’ve an application deployed with GlassFish v3 in Solaris.
This application used database Berkeley DB XML.
Sometimes, when a query to the database ends with error, i have to deploy the application again and I get this error:

The log message is null. com.sleepycat.db.RunRecoveryException
Complete Message

DB_RUNRECOVERY: Fatal error, run database recovery: PANIC: fatal region error detected; run recovery: DB_RUNRECOVERY: Fatal error, run database recovery at com.sleepycat.db.internal.db_javaJNI.DbEnv_open(Native Method) at com.sleepycat.db.internal.DbEnv.open(DbEnv.java:317) at com.sleepycat.db.EnvironmentConfig.openEnvironment(EnvironmentConfig.java:3886) at com.sleepycat.db.Environment. (Environment.java:93) at com.era7.lib.bdbxmlapi.BdbxmlManager.initEnvironment(BdbxmlManager.java:348) at com.era7.lib.bdbxmlapi.BdbxmlManager.init(BdbxmlManager.java:264) at com.era7.lib.bdbxmlapi.BdbxmlManager. (BdbxmlManager.java:134) at com.era7.doPlanning.appConf.listeners.DoPlanningApplicationListener.createManager(DoPlanningApplicationListener.java:171) at com.era7.doPlanning.appConf.listeners.DoPlanningApplicationListener.configureBdbxmlInitializationParams(DoPlanningApplicationListener.java:104) at com.era7.lib.slbdbxml.listeners.AbstractApplicationListener.contextInitialized(AbstractApplicationListener.java:51) at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4591) at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:535) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5193) at com.sun.enterprise.web.WebModule.start(WebModule.java:499) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1933) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1605) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339) at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:340) at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:163) at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174) at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87) at java.security.AccessController.doPrivileged(Native Method) at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84) at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77) at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58) at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107) at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60) at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236) at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128) at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457) at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401) at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700) at org.apache.felix.framework.Felix.startBundle(Felix.java:1622) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915) at org.jvnet.hk2.osgimain.Main.start(Main.java:140) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700) at org.apache.felix.framework.Felix.startBundle(Felix.java:1622) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) at java.lang.Thread.run(Thread.java:619)

My configuration is this:

public static int MAX_LOG_BUFFER_SIZE = 50 * 1024 * 1024;
public static int MAX_CACHE_SIZE = 5 * 1024 * 1024;
+/**+
* max num of simultaneous active transactions
*/
public static int MAX_ACTIVE_TXNS = 10000;
+//———————DEFAULT ENVIRONMENT CONFIGURATION VALUES———————————+
public static boolean RUN_RECOVERY_BY_DEFAULT = true;
public static int CACHE_SIZE_BY_DEFAULT = 5 * 1024 * 1024;
public static int MAX_ACTIVE_TXNS_BY_DEFAULT = 5000;
public static int LOG_BUFFER_SIZE_BY_DEFAULT = 50 * 1024 * 1024;
public static boolean ENVIRONMENT_LOG_IN_MEMORY = false;
public static boolean ENVIRONMENT_LOG_AUTO_REMOVE = true;
public static int ENVIRONMENT_LOG_REGION_SIZE = 3 * 1024 * 1024;
public static boolean ENVIRONMENT_TRANSACTIONAL = true;
public static boolean ENVIRONMENT_THREADED = true;
public static int ENVIRONMENT_TXN_MAX_ACTIVE = 5000;
public static int DEFAULT_MAX_LOCKS = 15000;//2000;
public static int DEFAULT_MAX_LOCKERS = 15000;//2000;
public static int DEFAULT_MAX_LOCK_OBJECTS = 15000;//2000;
+//———————————————————————————+
+//———————SEQUENCE CONFIGURATION VALUES——————-+
public static boolean ALLOW_CREATE_SEQUENCE_CONFIG = true;
public static int SEQUENCE_CACHE_SIZE = 0;
public static boolean DECREMENT_SEQUENCE_CONFIG = false;
public static int SEQUENCE_MIN_VALUE = 0;
public static int SEQUENCE_MAX_VALUE = 99999999;
public static int SEQUENCE_INITIAL_VALUE = 0;
public static boolean EXCLUSIVE_CREATE_SEQUENCE_CONFIG = false;
public static boolean WRAP_SEQUENCE_CONFIG = false;
+//———————————————————————-ç+
+//———————XMLMANAGER CONFIGURATION VALUES——————-+
public static boolean XML_MANAGER_LOG_ENABLED = false;
public static int XML_MANAGER_LOG_LEVEL = XmlManager.LEVEL_ERROR;
public static int XML_MANAGER_LOG_CATEGORY = XmlManager.CATEGORY_MANAGER;
+//———————————————————————-+
+//———————XMLCONTAINER CONFIGURATION VALUES——————-+
public static boolean XML_CONTAINER_INDEX_NODES_AND_STATISTICS_ENABLED = true;
public static boolean XML_CONTAINER_ALLOW_VALIDATION = false;
+//———————————————————————-+
+//———————SEQUENCE DATABASE CONFIGURATION VALUES——————-+
public static boolean ALLOW_CREATE_SEQUENCE_DATABASE_CONFIG = true;
public static boolean TRANSACTIONAL_SEQUENCE_DATABASE_CONFIG = true;
+//———————————————————————-+

Reading the logs I don’t find any other error apart from these WARNING:

+(javax.enterprise.system.container.web.com.sun.enterprise.web) Unsupported http-service property (redirect_2) is being ignored+

+(com.sun.grizzly.config.GrizzlyServiceListener) Interrupting idle Thread: http-thread-pool-8080+

Maybe it is neccesary to close the environment when some query to the database fails, i’m not sure.

Источник

How to Solve Error Message error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery when running yum command

Introduction

Another article in order for solving the error message exist in the title of the article. The error message appear upon the execution of ‘yum’ command. It is actually the execution of supervisor tool using ‘yum’ command. So, it is actually has a relation with another article exist in this link. It is an article with the title of ‘How to Install supervisord in Linux CentOS 7’. Before going on to the solution part, this introduction part will going to have another detail parts. Those parts are the error appearance part and the error trigger part.

Error Appearance

So, where does the error message actually appear ?. Basically, it appears in the process for installing ‘supervisor’ tool using ‘yum’ command. The following is the actual process on installing ‘supervisor’ using ‘yum’ where it actually stuck as in the following execution :

Error Trigger

What is the actual reason or the cause triggering the error message ?. Well, actually it is because of the previous execution of ‘yum -y install supervisord’. The previous execution is terminated in the middle of the process by typing ‘Ctrl + Z’. Moreover, after stopping the command execution by force, there is another step which killed the process entirely. The following is the execution of the command where it will trigger the error message as it exist in the previous part :

Solution

So, what is the actual solution for solving the problem ?. There are several articles available in the internet regarding on the solution. One of them which is becoming the reference for solving the solution in this article exist in this link. It is an article with the title of ‘Fix rpmdb: Thread died in Berkeley DB library’. So, the following is an attempt for trying to list the yum repository :

As in the output of the above command execution appear, it gives a simple error message which is hinting that there is something wrong with the ‘rpmdb’. In that case, the solution available in the link reference is worth to try. The following is the execution in sequence to solve the problem :

Finally, just execute the yum command once more. The following is an example using the installation of ‘supervisor’ tool with the following detail execution :

Источник

setaOffice

The rpm database got corrupted

# rpm -qa
rpmdb: Thread/process 17308/47583269480000 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
rpmdb: Thread/process 17308/47583269480000 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 database in /var/lib/rpm

Make a backup copy of /var/lib/rpm

root@linux:/var/lib # cp -pr rpm rpm.original

Listing the files inside /var/lib/rpm

root@linux:/var/lib/rpm # ls -al
total 127840
drwxr-xr-x. 2 root root 4096 Jul 15 21:08 .
drwxr-xr-x. 33 root root 4096 Sep 6 03:18 ..
-rw-r–r–. 1 root root 5619712 Jul 15 20:45 Basenames
-rw-r–r–. 1 root root 12288 Jul 15 20:45 Conflictname
-rw-r–r– 1 root root 73728 Sep 6 09:00 __db.001
-rw-r–r– 1 root root 237568 Sep 6 09:00 __db.002
-rw-r–r– 1 root root 1318912 Sep 6 09:00 __db.003
-rw-r–r– 1 root root 761856 Aug 31 14:30 __db.004
-rw-r–r–. 1 root root 3022848 Jul 15 20:45 Dirnames
-rw-r–r–. 1 root root 5558272 Jul 15 20:45 Filedigests
-rw-r–r–. 1 root root 24576 Jul 15 20:45 Group
-rw-r–r–. 1 root root 24576 Jul 15 20:45 Installtid
-rw-r–r–. 1 root root 40960 Jul 15 20:45 Name
-rw-r–r–. 1 root root 24576 Jul 15 20:45 Obsoletename
-rw-r–r–. 1 root root 112074752 Jul 15 20:45 Packages
-rw-r–r–. 1 root root 2465792 Jul 15 20:45 Providename
-rw-r–r–. 1 root root 1171456 Jul 15 20:45 Provideversion
-rw-r–r–. 1 root root 12288 Jul 10 2015 Pubkeys
-rw-r–r–. 1 root root 438272 Jul 15 20:45 Requirename
-rw-r–r–. 1 root root 270336 Jul 15 20:45 Requireversion
-rw-r–r–. 1 root root 0 Jul 10 2015 .rpm.lock
-rw-r–r–. 1 root root 167936 Jul 15 20:45 Sha1header
-rw-r–r–. 1 root root 81920 Jul 15 20:45 Sigmd5
-rw-r–r–. 1 root root 12288 Jul 15 20:45 Triggername

Removing all /var/lib/rpm/___db.XXX files

Listing the files again

root@linux:/var/lib/rpm # ls -la
total 125720
drwxr-xr-x. 2 root root 4096 Sep 6 09:07 .
drwxr-xr-x. 34 root root 4096 Sep 6 09:07 ..
-rw-r–r–. 1 root root 5619712 Jul 15 20:45 Basenames
-rw-r–r–. 1 root root 12288 Jul 15 20:45 Conflictname
-rw-r–r–. 1 root root 3022848 Jul 15 20:45 Dirnames
-rw-r–r–. 1 root root 5558272 Jul 15 20:45 Filedigests
-rw-r–r–. 1 root root 24576 Jul 15 20:45 Group
-rw-r–r–. 1 root root 24576 Jul 15 20:45 Installtid
-rw-r–r–. 1 root root 40960 Jul 15 20:45 Name
-rw-r–r–. 1 root root 24576 Jul 15 20:45 Obsoletename
-rw-r–r–. 1 root root 112074752 Jul 15 20:45 Packages
-rw-r–r–. 1 root root 2465792 Jul 15 20:45 Providename
-rw-r–r–. 1 root root 1171456 Jul 15 20:45 Provideversion
-rw-r–r–. 1 root root 12288 Jul 10 2015 Pubkeys
-rw-r–r–. 1 root root 438272 Jul 15 20:45 Requirename
-rw-r–r–. 1 root root 270336 Jul 15 20:45 Requireversion
-rw-r–r–. 1 root root 0 Jul 10 2015 .rpm.lock
-rw-r–r–. 1 root root 167936 Jul 15 20:45 Sha1header
-rw-r–r–. 1 root root 81920 Jul 15 20:45 Sigmd5
-rw-r–r–. 1 root root 12288 Jul 15 20:45 Triggername

Rebuilding database indices from installed package headers

Use –initdb to create a new database if one doesn’t already exist (existing database is not overwritten), use –rebuilddb to rebuild the
database indices from the installed package headers.

root@linux:/var/lib/rpm # rpm –rebuilddb

Источник

Introduction

Another article in order for solving the error message exist in the title of the article. The error message appear upon the execution of ‘yum’ command. It is actually the execution of supervisor tool using ‘yum’ command. So, it is actually has a relation with another article exist in this link. It is an article with the title of ‘How to Install supervisord in Linux CentOS 7’. Before going on to the solution part, this introduction part will going to have another detail parts. Those parts are the error appearance part and the error trigger part.

Error Appearance

So, where does the error message actually appear ?. Basically, it appears in the process for installing ‘supervisor’ tool using ‘yum’ command. The following is the actual process on installing ‘supervisor’ using ‘yum’ where it actually stuck as in the following execution :

[root@localhost ~]# yum -y install supervisor
error: rpmdb: BDB0113 Thread/process 2020/140598702356288 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
[1]+ Killed yum -y install supervisord
[root@localhost ~]# yum -y install supervisor
error: rpmdb: BDB0113 Thread/process 2020/140598702356288 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
[root@localhost ~]#

Error Trigger

What is the actual reason or the cause triggering the error message ?. Well, actually it is because of the previous execution of ‘yum -y install supervisord’. The previous execution is terminated in the middle of the process by typing ‘Ctrl + Z’. Moreover, after stopping the command execution by force, there is another step which killed the process entirely. The following is the execution of the command where it will trigger the error message as it exist in the previous part :

[root@localhost ~]# yum -y install supervisord
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
* epel: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
* extras: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
* updates: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
No package supervisord available.

^C^C^C^C^Z
[1]+ Stopped yum -y install supervisord
[root@localhost ~]# yum -y install supervisor
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 2020.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 43 M RSS (367 MB VSZ)
Started: Thu Nov 25 16:22:20 2021 - 00:20 ago
State : Traced/Stopped, pid: 2020
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 43 M RSS (367 MB VSZ)
Started: Thu Nov 25 16:22:20 2021 - 00:22 ago
State : Traced/Stopped, pid: 2020
^C

Exiting on user cancel.
[root@localhost ~]# ps -aux | grep yum
root 2020 1.5 1.1 376292 44156 pts/0 T 16:22 0:00 /usr/bin/python /bin/yum -y install supervisord
root 2023 0.0 0.0 112808 976 pts/0 S+ 16:22 0:00 grep --color=auto yum
[root@localhost ~]# kill -9 2020

Solution

So, what is the actual solution for solving the problem ?.  There are several articles available in the internet regarding on the solution. One of them which is becoming the reference for solving the solution in this article exist in this link. It is an article with the title of ‘Fix rpmdb: Thread died in Berkeley DB library’. So, the following is an attempt for trying to list the yum repository :

[root@localhost ~]# yum repolist
error: rpmdb: BDB0113 Thread/process 2020/140598702356288 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
[root@localhost ~]#

As in the output of the above command execution appear, it gives a simple error message which is hinting that there is something wrong with the ‘rpmdb’. In that case, the solution available in the link reference is worth to try. The following is the execution in sequence to solve the problem :

[root@localhost ~]# ps aux | grep yum
root 2030 0.0 0.0 112808 976 pts/0 R+ 16:23 0:00 grep --color=auto yum
[root@localhost ~]# mkdir /var/lib/rpm/backup
[root@localhost ~]# cp -a /var/lib/rpm__db* /var/lib/rpm/backup/
cp: cannot stat ‘/var/lib/rpm__db*’: No such file or directory
[root@localhost ~]# cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
[root@localhost ~]# rm -f /var/lib/rpm/__db.[0-9][0-9]*
[root@localhost ~]# rpm --quiet -qa
[root@localhost ~]# rpm --rebuilddb
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base docker-ce-stable epel extras pgdg-common pgdg10 pgdg11 pgdg12 pgdg13 pgdg14 pgdg96 updates
Cleaning up list of fastest mirrors
[root@localhost ~]#

Finally, just execute the yum command once more. The following is an example using the installation of ‘supervisor’ tool with the following detail execution :

[root@localhost ~]# yum -y install supervisor
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                                 | 7.9 kB  00:00:00
 * base: xxxxxxx.xxxxx.xxx.xx
 * epel: xxxxxxx.xxxxxxxxxxxxxxx.xxx.xx
 * extras: xxxxxxx.xxxxxxx.xxx.xx
 * updates: xxxxxxx.xxxxx.xxxxx
base                                                                                                                                                 | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                                     | 3.5 kB  00:00:00
epel                                                                                                                                                 | 4.7 kB  00:00:00
extras                                                                                                                                               | 2.9 kB  00:00:00
pgdg-common/7/x86_64/signature                                                                                                                       |  198 B  00:00:00
pgdg-common/7/x86_64/signature                                                                                                                       | 2.9 kB  00:00:00 !!!
pgdg10/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg10/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg11/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg11/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg12/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg12/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg13/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg13/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg14/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg14/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg96/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg96/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
updates                                                                                                                                              | 2.9 kB  00:00:00
(1/22): base/7/x86_64/group_gz                                                                                                                       | 153 kB  00:00:00
(2/22): docker-ce-stable/7/x86_64/primary_db                                                                                                         |  69 kB  00:00:00
(3/22): docker-ce-stable/7/x86_64/updateinfo                                                                                                         |   55 B  00:00:00
(4/22): epel/x86_64/group_gz                                                                                                                         |  96 kB  00:00:00
(5/22): epel/x86_64/updateinfo                                                                                                                       | 1.0 MB  00:00:00
(6/22): extras/7/x86_64/primary_db                                                                                                                   | 243 kB  00:00:00
(7/22): pgdg10/7/x86_64/group_gz                                                                                                                     |  245 B  00:00:01
(8/22): base/7/x86_64/primary_db                                                                                                                     | 6.1 MB  00:00:01
(9/22): pgdg11/7/x86_64/group_gz                                                                                                                     |  245 B  00:00:00
(10/22): pgdg12/7/x86_64/group_gz                                                                                                                    |  245 B  00:00:00
(11/22): pgdg-common/7/x86_64/primary_db                                                                                                             | 147 kB  00:00:01
(12/22): pgdg13/7/x86_64/group_gz                                                                                                                    |  246 B  00:00:00
(13/22): pgdg10/7/x86_64/primary_db                                                                                                                  | 355 kB  00:00:01
(14/22): pgdg13/7/x86_64/primary_db                                                                                                                  | 155 kB  00:00:00
(15/22): pgdg14/7/x86_64/group_gz                                                                                                                    |  244 B  00:00:00
(16/22): pgdg12/7/x86_64/primary_db                                                                                                                  | 240 kB  00:00:00
(17/22): pgdg14/7/x86_64/primary_db                                                                                                                  |  72 kB  00:00:00
(18/22): pgdg96/7/x86_64/group_gz                                                                                                                    |  249 B  00:00:00
(19/22): pgdg11/7/x86_64/primary_db                                                                                                                  | 380 kB  00:00:01
(20/22): pgdg96/7/x86_64/primary_db                                                                                                                  | 341 kB  00:00:00
(21/22): epel/x86_64/primary_db                                                                                                                      | 7.0 MB  00:00:03
(22/22): updates/7/x86_64/primary_db                                                                                                                 |  12 MB  00:00:02
Resolving Dependencies
--> Running transaction check
---> Package supervisor.noarch 0:3.4.0-1.el7 will be installed
--> Processing Dependency: python-meld3 >= 0.6.5 for package: supervisor-3.4.0-1.el7.noarch
--> Running transaction check
---> Package python-meld3.x86_64 0:0.6.10-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================
 Package                                     Arch                                  Version                                        Repository                           Size
============================================================================================================================================================================
Installing:
 supervisor                                  noarch                                3.4.0-1.el7                                    epel                                498 k
Installing for dependencies:
 python-meld3                                x86_64                                0.6.10-1.el7                                   epel                                 73 k

Transaction Summary
============================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 571 k
Installed size: 2.9 M
Downloading packages:
(1/2): python-meld3-0.6.10-1.el7.x86_64.rpm                                                                                                          |  73 kB  00:00:00
(2/2): supervisor-3.4.0-1.el7.noarch.rpm                                                                                                             | 498 kB  00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       1.5 MB/s | 571 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-meld3-0.6.10-1.el7.x86_64                                                                                                                         1/2
  Installing : supervisor-3.4.0-1.el7.noarch                                                                                                                            2/2
  Verifying  : python-meld3-0.6.10-1.el7.x86_64                                                                                                                         1/2
  Verifying  : supervisor-3.4.0-1.el7.noarch                                                                                                                            2/2

Installed:
  supervisor.noarch 0:3.4.0-1.el7

Dependency Installed:
  python-meld3.x86_64 0:0.6.10-1.el7

Complete!
[root@localhost ~]#

Last updated on:  2021-04-12

Authored by:  Uriel Amar


This article explains how to fix CentOS® server issues
with the yum cache not updating due to a failed check update.
Several errors might display during this process depending on
the issue’s cause. The following breakdown shows how to identify and resolve
these issues:

Clear yum cache

The following command ensures that no issues exist relating to corrupted metadata
files, missing references, or temporarily free up disk space.

yum clean all

Check for missing repositories

Run the following command to ensure there are no missing repositories.

yum repolist all

You can also verify this inside the /etc/yum.repos.d folder. You can then
install any missing repositories with the yum install command or add a
file manually into the /etc/yum.repos.d folder.

Check for disabled repositories

If the necessary repositories are available but not working, perform the following steps
to edit the repository file:

  1. Run the following command replacing [filename] with the
    repository filename and [extension] with the respective extension:

    cat [filename].[extension]
    
  2. Open the repository file in the editor of your choice and change the value
    enabled=0 to enabled=1.

  3. Run the following command to update the package list and install the
    software:

    yum update
    

Troubleshoot a PycURL error

Several different types of errors might display if the repository file is
corrupted. For example, if the yum install command fails with the following
error, it might be due to an incorrect repository URL, as shown in this example:

[Errno 14]  - "The requested URL returned error: 403"  
Trying other mirror.

Correcting the repository URL in the repository file and cleaning the yum cache
should fix this issue.

yum clean all

Additionally, you can use the yum clean metadata command to clear the metadata
cache if any additional XML files caused the corruption.

Troubleshoot a Fatal error, run database recovery error

If yum fails with a Fatal error, run database recovery message, you should delete
the database and manually rebuild it by using the following commands:

rm -f /var/lib/rpm__db*
rpm -rebuilddb
yum clean all
yum update

Check for dependency conflicts

If you can’t install a package because of a missing dependency or
mismatched version, manually installing each dependency might fix this issue.
Additionally, deleting and reinstalling the local package might resolve version
mismatches.

Unfortunately, there is no easy fix for most dependency issues because of the many
factors involved. In those cases, consider adding a repository that
contains the correct dependency.

I’m trying to run yum update and I’m running this error:

rpmdb: PANIC: fatal region error detected; run recovery
error: db3 error(-30974) from dbenv->open: 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:

Error: rpmdb open failed

I checked page like this one but running yum clean all runs the same error.

How can I solve this?

asked Apr 25, 2015 at 15:40

Alex Jolig's user avatar

1

This is how I fixed my problem.

You may fix this by cleaning out rpm database. But first, in order to minimize the risk, make sure you create a backup of files in /var/lib/rpm/ using cp command:

mkdir /root/backups.rpm.mm_dd_yyyy/
cp -avr /var/lib/rpm/ /root/backups.rpm.mm_dd_yyyy/

The try this to fix this problem:

# rm -f /var/lib/rpm/__db*
# db_verify /var/lib/rpm/Packages
# rpm --rebuilddb
# yum clean all

And finally verify that error has gone with the following yum command

# yum update

answered Apr 25, 2015 at 15:40

Alex Jolig's user avatar

Alex JoligAlex Jolig

2,2193 gold badges14 silver badges19 bronze badges

7

All I had to do was to delete the two file with the «.lock» extension, and the three files that started with «__db».

# rm /var/lib/rpm/.dbenv.lock
# rm /var/lib/rpm/.rpm.lock
# rm /var/lib/rpm/__db*

After that, yum update worked.

answered Jan 17, 2019 at 19:00

isapir's user avatar

isapirisapir

3983 silver badges11 bronze badges

Thanks Alex, your answer worked for me apart from one slight change I had to make.

rm -f /var/lib/rpm/__db*

returned errors

rm: cannot remove `/var/lib/rpm/__db.001': Is a directory
rm: cannot remove `/var/lib/rpm/__db.002': Is a directory
rm: cannot remove `/var/lib/rpm/__db.004': Is a directory

so I had to recurse with

rm -rf /var/lib/rpm/__db*

answered Jun 6, 2015 at 20:18

Ian Ellis's user avatar

1

I tried the above one it did’nt work

below works fine

# cd /var/lib
# tar -zcvf /var/preserve/rpmdb-$(date +%Y-%m-%d_%H-%M-%S).tar.gz rpm

Note: This tar backup can be used if the attempt to recover the RPM database has issues.

Verify integrity of the Packages file:

# cd /var/lib/rpm
# rm -f __db*      # to avoid stale locks
# /usr/lib/rpm/rpmdb_verify Packages

# mv Packages Packages.orig
# /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages


# rpm -vv --rebuilddb

Once again verify RPM database:

# cd /var/lib/rpm
# /usr/lib/rpm/rpmdb_verify Packages

answered Apr 16, 2018 at 7:30

AReddy's user avatar

AReddyAReddy

3,0545 gold badges34 silver badges70 bronze badges

2

Понравилась статья? Поделить с друзьями:
  • Your video card does not support alpha blending with floating point render targets как исправить
  • Андроид начал тормозить как исправить
  • Your system is missing runtime components that obs как исправить
  • Андроид магнитола плохо ловит радио как исправить
  • Your steam username cannot be just a number как исправить