05 Dec 2007

YUM issue: TypeError: Parsing primary.xml error 

By - Linux 1 Comment

When running a ‘yum check-update’, I would receive an error. The error continued even after running ‘yum clean all’.

The error is shown below:

# yum check-update
Setting up repositories
core 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 1.2 kB 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 1.0 MB 00:00
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 94, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 381, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File "/usr/share/yum-cli/yumcommands.py", line 317, in doCommand
ypl = base.returnPkgLists(extcmds)
File "/usr/share/yum-cli/cli.py", line 895, in returnPkgLists
ypl = self.doPackageLists(pkgnarrow=pkgnarrow)
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 994, in doPackageLists
self.doRepoSetup()
File "/usr/share/yum-cli/cli.py", line 109, in doRepoSetup
self.doSackSetup(thisrepo=thisrepo)
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 338, in doSackSetup
self.repos.populateSack(which=repos)
File "/usr/lib/python2.4/site-packages/yum/repos.py", line 200, in populateSack
sack.populate(repo, with, callback, cacheonly)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 91, in populate
dobj = repo.cacheHandler.getPrimary(xml, csum)
File "/usr/lib64/python2.4/site-packages/sqlitecachec.py", line 40, in getPrimary self.repoid))
TypeError: Parsing primary.xml error: Start tag expected, '<' not found

This took me way longer than it should have to figure out, but I determined from running ‘createrpo’, that the error was actually in a shared library.

# createrepo
Traceback (most recent call last):
File "/usr/share/createrepo/genpkgmetadata.py", line 27, in ?
import libxml2
File "/usr/lib64/python2.4/site-packages/libxml2.py", line 1, in ?
import libxml2mod
ImportError: /usr/lib64/python2.4/site-packages/libxml2mod.so: undefined symbol: xmlXPathContextSetCache

# ldd /usr/lib64/python2.4/site-packages/libxml2mod.so
libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x00002b61705e9000)
libc.so.6 => /lib64/libc.so.6 (0x00002b6170921000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b6170c6f000)
libm.so.6 => /lib64/libm.so.6 (0x00002b6170e74000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

Notice /usr/local/lib in the above section.

So, I then discovered the problem.
# env|grep -i lib
LD_LIBRARY_PATH=/usr/local/lib

Somewhere along the way, someone set LD_LIBRARY_PATH in .bash_profile.

Once the LD_LIBRARY_PATH environment variable was removed, the issue went away!

One Response to “YUM issue: TypeError: Parsing primary.xml error”

  1. john says:

    hey thanks so much!!! I had the same problem when I tried to build xine and change my library path. I couldnt figure out why yum stopped working. I was at the end of the road ..

    thanks again!! John

Leave a Reply