I have seen a similar issue using 'yum check-update' on Ubunty Trusty with libxml2=2.9.1+dfsg1-3ubuntu4.8 failing to parse the primary.xml.gz index. $ yum check-update custom-repo: [########################################################################### ] 6900/6903 (process:1482): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Parsing primary.xml error: attributes construct error (process:1482): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Parsing primary.xml error: Couldn't find end of Start Tag size line 238347 (process:1482): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Parsing primary.xml error: Premature end of data in tag package line 238338 (process:1482): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Parsing primary.xml error: Premature end of data in tag metadata line 2 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 288, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 140, in main result, resultmsgs = base.doCommands() File "/usr/share/yum-cli/cli.py", line 436, in doCommands self._getTs(needTsRemove) File "/usr/lib/python2.7/dist-packages/yum/depsolve.py", line 101, in _getTs self._getTsInfo(remove_only) File "/usr/lib/python2.7/dist-packages/yum/depsolve.py", line 112, in _getTsInfo pkgSack = self.pkgSack File "/usr/lib/python2.7/dist-packages/yum/__init__.py", line 892, in pkgSack = property(fget=lambda self: self._getSacks(), File "/usr/lib/python2.7/dist-packages/yum/__init__.py", line 673, in _getSacks self.repos.populateSack(which=repos) File "/usr/lib/python2.7/dist-packages/yum/repos.py", line 294, in populateSack sack.populate(repo, mdtype, callback, cacheonly) File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 190, in populate dobj = repo_cache_function(xml, csum) File "/usr/lib/python2.7/dist-packages/sqlitecachec.py", line 46, in getPrimary self.repoid)) TypeError: Parsing primary.xml error: Specification mandate value for attribute archive I have seen this a few times, but never took the time to dig into it until recently. What I found was the size of the primary.xml.gz file is what seems to be causing the failure. If (size of file in bytes)/(8192 bytes) has a remainder of 1 byte this failure will occur. Basically, in the case of "yum check-update", if the last read (that returns more than 0 bytes) on the primary.xml.gz file ONLY contains a single null character it fails. strace excerpt (with the primary.xml.gz as fd 5): read(5, "\0", 8192) = 1 read(5, "", 8191) = 0 After the above it fails immediately. Updating libxml2 to v2.9.3+dfsg1-1ubuntu0.2 from the Ubuntu Xenial repos seems to fix the problem, but that is not an acceptable solution in my case because the Xenial package brings in some other dependencies that I cannot update to. Any chance someone could fix this issue for Ubuntu Trusty?