Sunday, February 12, 2012

yum (rpmdb: PANIC: fatal region error detected; run recovery)


[root@localhost ~]# yum install squid
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading "skip-broken" plugin
Loading "protectbase" plugin
Loading "changelog" plugin
Loading "downloadonly" plugin
Loading "allowdowngrade" plugin
Loading "kernel-module" plugin
Loading "tsflags" plugin
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30977) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30977)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 85, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 163, in getOptionsConfig
    disabled_plugins=self.optparser._splitArg(opts.disableplugins))
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 164, in _getConfig
    self._conf = config.readMainConfig(startupconf)
  File "/usr/lib/python2.4/site-packages/yum/config.py", line 685, in readMainConfig
    yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
  File "/usr/lib/python2.4/site-packages/yum/config.py", line 755, in _getsysver
    idx = ts.dbMatch('provides', distroverpkg)
TypeError: rpmdb open failed

[root@localhost ~]# rm -f /var/lib/rpm/__db*
[root@localhost ~]# rpm --rebuilddb
[root@localhost ~]# yum clean all 
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading "skip-broken" plugin
Loading "protectbase" plugin
Loading "changelog" plugin
Loading "downloadonly" plugin
Loading "allowdowngrade" plugin
Loading "kernel-module" plugin
Loading "tsflags" plugin
Cleaning up Everything
Cleaning up list of fastest mirrors

[root@localhost ~]# yum install squid
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading "skip-broken" plugin
Loading "protectbase" plugin
Loading "changelog" plugin
Loading "downloadonly" plugin
Loading "allowdowngrade" plugin
Loading "kernel-module" plugin
Loading "tsflags" plugin
Determining fastest mirrors
 * rpmfusion-free-updates-testing: mirror.transact.net.au
 * base: mirror.pscigrid.gov.ph
 * updates: centosz3-msync-dvd.centos.org
 * rpmfusion-free-updates: mirror.transact.net.au
 * addons: mirror.pscigrid.gov.ph
 * extras: mirror.optus.net
rpmfusion-free-updates-te 100% |=========================| 2.8 kB    00:00     
47027e209e5c5c5d58719a490 100% |=========================|  57 kB    00:00     
base                      100% |=========================| 2.1 kB    00:00     
primary.sqlite.bz2        100% |=========================| 1.6 MB    01:34 
updates                   100% |=========================| 1.9 kB    00:00     
primary.sqlite.bz2        100% |=========================| 459 kB    00:04     
rpmfusion-free-updates    100% |=========================| 2.8 kB    00:00     
763a1aa69ace5e0d4f454974f 100% |=========================| 3.0 kB    00:00     
addons                    100% |=========================|  951 B    00:00     
primary.xml.gz            100% |=========================|  201 B    00:00     
extras                    100% |=========================| 1.1 kB    00:00     
primary.xml.gz            100% |=========================| 107 kB    00:02     
extras    : ################################################## 325/325
0 packages excluded due to repository priority protections
0 packages excluded due to repository protections
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package squid.i386 7:2.6.STABLE21-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Updating:
 squid                   i386       7:2.6.STABLE21-3.el5  base              1.3 M

Transaction Summary
=============================================================================
Install      0 Package(s)         
Update       1 Package(s)         
Remove       0 Package(s)         

Total download size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): squid-2.6.STABLE21 100% |=========================| 1.3 MB    00:41     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating  : squid                        ######################### [1/2] 
  Cleanup   : squid                        ######################### [2/2] 

Updated: squid.i386 7:2.6.STABLE21-3.el5
Complete!