Saturday, November 9, 2013

Yum Error: cannot open Packages database


Share at Facebook

Sometimes it may happen that an error like below is popping out at your CentOS linux box. I don't know why it caused, but know how to resolve this.


Loading "fastestmirror" plugin
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}
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



Here is the solution that worked for my case:


[root~]# rm /dev/urandom
[root~]# mknod -m 644 /dev/urandom c 1 9
[root~]# yum clean all



Let me know if you know any other ways to handle this situation. I'd love to learn that case.





No comments: