0

I'm getting checksum error when doing Yum update due to Yum looking for Nginx package from CentOS 6 repo (I'm using Centos 5.6).

Below is the error: http://nginx.org/packages/centos/6/x86_64/repodata/a017491800bf2f9c0d3d043d30ca1e065ff89212b35159c0fa201fd9c02f77f3-primary.sqlite.bz2: [Errno -3] Error performing checksum Trying other mirror.

Is there a way to uninstall Nginx from Yum manually?

  • nginx provided a repo for CentOS 5; why did you not use it? – Michael Hampton Jul 9 '13 at 19:05
3

Installing packages from a CentOS 6 repo on CentOS 5 is ill-advised and should be avoided. Please just upgrade to CentOS 6 completely if you want this. Alternatively, manually grab the source rpm and rebuild it on CentOS 5.

As to why this fails: the newer createrepo for CentOS 6 uses a different algorithm for checksums than the one used by yum in CentOS 5 (sha256 vs sha1 iirc), so your yum has no way of verifying the repository contents.

  • Unfortunately CentOS upgrade is not really stable according to Red Hat website so they advise re-install. I don't really want to do that as it would be a lot of hassles with multiple configurations done on the site. I would rather uninstall Nginx manually as it's not used at the moment. Is there a way to uninstall Nginx in this case? – Passionate Developer May 25 '13 at 7:22
  • yum remove nginx will remove it and everything that depends on it. You will also need to remove the nginx repository from your yum config. – Dennis Kaarsemaker May 25 '13 at 7:25
  • I still get the same checksum error as per my initial post above when I do yum remove nginx – Passionate Developer May 25 '13 at 7:30
  • That's because you didn't do the second thing I said :) – Dennis Kaarsemaker May 25 '13 at 19:36
0

Try below command

   yum clean all

and then a

   yum update

or a

   yum upgrade
  • While good advise in general, this won't help in this case as the repository and yum are fundamentally incompatible. – Dennis Kaarsemaker May 25 '13 at 7:20
0

I had the same error message. In my case, the problem was that the repository server indexed its RPMs using the sha256 checksum algorithm while the yum client software only knew about plain sha checksums.

My solution:

  1. Install python-hashlib (docs for Python 2 / 3).
  2. Remove the 2 files /usr/lib/python*/site-packages/yum/{repos,misc}.pyc
  3. Patch the file /usr/lib/python*/site-packages/yum/repos.py by replacing:

        elif sumtype == 'sha':
            import sha
            sum = sha.new()
        else:
            raise Errors.RepoError, 'Error Checksumming file, wrong \                                                                                                                      
                                     checksum type %s' % sumtype
    

    ... with:

        elif sumtype == 'sha':
            import sha
            sum = sha.new()
        else:
            import hashlib
            if "algorithms" in hashlib.__dict__ and sumtype in hashlib.algorithms:
                sum = hashlib.new(sumtype)
            elif sumtype in hashlib.__dict__:
                sum = hashlib.__dict__[sumtype]()
            else:
                raise Errors.RepoError, 'Error Checksumming file, wrong \                                                                                                                      
                                         checksum type %s' % sumtype
    
  4. Patch the file /usr/lib/python*/site-packages/yum/misc.py by replacing:

    else:
        raise MiscError, 'Error Checksumming file, bad checksum type %s' % sumtype
    

    ... with:

    else:
        import hashlib
        if "algorithms" in hashlib.__dict__ and sumtype in hashlib.algorithms:
            sum = hashlib.new(sumtype)
        elif sumtype in hashlib.__dict__:
            sum = hashlib.__dict__[sumtype]()
        else:
            raise MiscError, 'Error Checksumming file, bad checksum type %s' % sumtype
    

yum should now understand and handle the sha256 checksums distributed by the repository server, so you should be able to run your command again without this issue showing up.

The new code will attempt to use hashlib when the yum client does not already recognize the checksum. It should be flexible enough to handle the future addition of hashes to hashlib and the repository indexer itself without further modification of the yum client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.