I got the following error on an OpenVZ container when trying to yum update it.
# yum update Loaded plugins: fastestmirror 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.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 309, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 157, in main base.getOptionsConfig(args) File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig self.conf File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 665, in <lambda> conf = property(fget=lambda self: self._getConfig(), File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 240, in _getConfig self._conf = config.readMainConfig(startupconf) File "/usr/lib/python2.4/site-packages/yum/config.py", line 804, in readMainConfig yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg) File "/usr/lib/python2.4/site-packages/yum/config.py", line 877, in _getsysver idx = ts.dbMatch('provides', distroverpkg) TypeError: rpmdb open failed
The first thing you could try is follow the error: cannot open Packages database in /%{_dbpath} error and rebuild your RPM base. This can be done without harm to your system.
# rm -f /var/lib/rpm/__* # rpm --rebuilddb # yum update
In case that doesn’t fix it, re-create the **/dev/urandom/ **device with mknod.
# rm -f /dev/urandom # mknod -m 644 /dev/urandom c 1 9
And try to run a new yum update, that should be better.