I've been having problems with yum(8) on one of the CentOS 6 x86_64 machines. After looking at many different forums and bug reports, I now found the solution.
The problem was very bad. When I would use yum(8), I would get this ugly Python error :
sudo yum -y update --exclude=yum
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: www.cubiculestudio.com
* extras: centos.mirror.rafal.ca
* updates: www.cubiculestudio.com
base | 3.7 kB 00:00
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 276, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 129, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 434, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 883, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 668, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 294, in populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 164, in populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 222, in _check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1263, in _check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1462, in <lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1454, in _getRepoXML
self._loadRepoXML(text=self)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1444, in _loadRepoXML
return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1419, in _groupLoadRepoXML
if self._commonLoadRepoXML(text):
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1237, in _commonLoadRepoXML
result = self._getFileRepoXML(local, text)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1015, in _getFileRepoXML
size=102400) # setting max size as 100K
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 837, in _getFile
size=size
File "/usr/lib/python2.6/site-packages/urlgrabber/mirror.py", line 408, in urlgrab
return self._mirror_try(func, url, kw)
File "/usr/lib/python2.6/site-packages/urlgrabber/mirror.py", line 394, in _mirror_try
return func_ref( *(fullurl,), **kwargs )
File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 985, in urlgrab
return self._retry(opts, retryfunc, url, filename)
File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 886, in _retry
r = apply(func, (opts,) + args, {})
File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 980, in retryfunc
apply(cb_func, (obj, )+cb_args, cb_kwargs)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1501, in _checkRepoXML
repoXML = repoMDObject.RepoMD(self.id, filepath)
File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 124, in __init__
self.parse(srcfile)
File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 140, in parse
parser = iterparse(infile)
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1169, in cElementTree_iterparse
_cElementTree_import()
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
import cElementTree
ImportError: No module named cElementTree
I searched the web and found quite a lot of other frustrated yum users. One of them suggested to test python right at the source : from python's shell.
sudo python
Python 2.6.6 (r266:84292, Jun 18 2012, 14:18:47)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree import cElementTree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/xml/etree/cElementTree.py", line 3, in <module>
from _elementtree import *
ImportError: /usr/lib64/python2.6/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_2_0_1_RH not defined in file libexpat.so.1 with link time reference
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
So my pyexpat.so file is having problems? Ok, let's find it just for fun?
sudo find /lib /lib64 /usr /opt -type f -iname "libexpat.so*"
/lib64/libexpat.so.1.5.2
In the end, the error was coming from the shared library dependencies. These are configured in the /etc/ld.so.conf file. Which is very basic
cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
That says to load any configurations files ending with .conf found in the ld.so.conf.d directory. When I took a look at the content of this directory, I found this :
ls -1 /etc/ld.so.conf.d/*.conf
/etc/ld.so.conf.d/atlas-x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.13.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.17.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.23.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.4.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-358.0.1.el6.x86_64.conf
/etc/ld.so.conf.d/mysql-x86_64.conf
/etc/ld.so.conf.d/qt-x86_64.conf
/etc/ld.so.conf.d/xulrunner-64.conf
There's a lot of items here. Looking at this, I tried to remove all the non-CentOS configurations. Starting with the obvious one : oracle.conf.
sudo mv /etc/ld.so.conf.d/oracle.conf /tmp
sudo ldconfig
And voilĂ ! Problem solved.
So basically, if you have this problem, double check your libraries. That's probably where the problem is.
The problem was very bad. When I would use yum(8), I would get this ugly Python error :
sudo yum -y update --exclude=yum
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: www.cubiculestudio.com
* extras: centos.mirror.rafal.ca
* updates: www.cubiculestudio.com
base | 3.7 kB 00:00
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 276, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 129, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 434, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 883, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 668, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 294, in populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 164, in populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 222, in _check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1263, in _check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1462, in <lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1454, in _getRepoXML
self._loadRepoXML(text=self)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1444, in _loadRepoXML
return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1419, in _groupLoadRepoXML
if self._commonLoadRepoXML(text):
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1237, in _commonLoadRepoXML
result = self._getFileRepoXML(local, text)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1015, in _getFileRepoXML
size=102400) # setting max size as 100K
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 837, in _getFile
size=size
File "/usr/lib/python2.6/site-packages/urlgrabber/mirror.py", line 408, in urlgrab
return self._mirror_try(func, url, kw)
File "/usr/lib/python2.6/site-packages/urlgrabber/mirror.py", line 394, in _mirror_try
return func_ref( *(fullurl,), **kwargs )
File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 985, in urlgrab
return self._retry(opts, retryfunc, url, filename)
File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 886, in _retry
r = apply(func, (opts,) + args, {})
File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 980, in retryfunc
apply(cb_func, (obj, )+cb_args, cb_kwargs)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1501, in _checkRepoXML
repoXML = repoMDObject.RepoMD(self.id, filepath)
File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 124, in __init__
self.parse(srcfile)
File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 140, in parse
parser = iterparse(infile)
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1169, in cElementTree_iterparse
_cElementTree_import()
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
import cElementTree
ImportError: No module named cElementTree
sudo python
Python 2.6.6 (r266:84292, Jun 18 2012, 14:18:47)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree import cElementTree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/xml/etree/cElementTree.py", line 3, in <module>
from _elementtree import *
ImportError: /usr/lib64/python2.6/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_2_0_1_RH not defined in file libexpat.so.1 with link time reference
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
So my pyexpat.so file is having problems? Ok, let's find it just for fun?
sudo find /lib /lib64 /usr /opt -type f -iname "libexpat.so*"
/lib64/libexpat.so.1.5.2
/opt/oracle/product/11.2.0/client_1/lib/libexpat.so.1
/opt/oracle/product/11.2.0/client_1/lib/libexpat.so.1.5.2
What's this Oracle file? Could it be causing me all those problems?
In the end, the error was coming from the shared library dependencies. These are configured in the /etc/ld.so.conf file. Which is very basic
cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
That says to load any configurations files ending with .conf found in the ld.so.conf.d directory. When I took a look at the content of this directory, I found this :
ls -1 /etc/ld.so.conf.d/*.conf
/etc/ld.so.conf.d/atlas-x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.13.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.17.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.23.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-220.4.1.el6.x86_64.conf
/etc/ld.so.conf.d/kernel-2.6.32-358.0.1.el6.x86_64.conf
/etc/ld.so.conf.d/mysql-x86_64.conf
/etc/ld.so.conf.d/qt-x86_64.conf
/etc/ld.so.conf.d/xulrunner-64.conf
/etc/ld.so.conf.d/oracle.conf
There's a lot of items here. Looking at this, I tried to remove all the non-CentOS configurations. Starting with the obvious one : oracle.conf.
sudo mv /etc/ld.so.conf.d/oracle.conf /tmp
sudo ldconfig
And voilĂ ! Problem solved.
So basically, if you have this problem, double check your libraries. That's probably where the problem is.