Yum: error: no dbpath has been set on Centos Servers

Yum: error: no dbpath has been set on Centos Servers

If you have to deal with a CentOS server, there are some specific solutions, that should be known by a Linux administrator. Today I will post the solution for yum error.

You can get this error on software update. For example, when trying to update the installed packages:

root@srv [~]# yum update
Loading “installonlyn” 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 82, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 206, in getOptionsConfig
errorlevel=opts.errorlevel)
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 132, in
doConfigSetup
self.conf = config.readMainConfig(startupconf)
File “/usr/lib/python2.4/site-packages/yum/config.py”, line 598, in
readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot,
startupconf.distroverpkg)
File “/usr/lib/python2.4/site-packages/yum/config.py”, line 661, in
_getsysver
idx = ts.dbMatch(‘provides’, distroverpkg)
TypeError: rpmdb open failed

Let’s see the error message. It tells us: error: no dbpath has been set. How should we proceed?

First of all, you need to try to clear the database. Here is the set of commands that should help you to do this:

#yum clean all
#rm -f /var/lib/rpm/__db*
#rpm –rebuilddb
#yum update

If this doesn’t help, here is another set:

#rm /dev/urandom
#mknod -m 644 /dev/urandom c 1 9

After that, run

#yum clean all

This should do the trick.

No comments yet.

Leave a Reply

Contact us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Questions, issues or concerns? I'd love to help you!

Click ENTER to chat