How to fix yum [Errno -1] Metadata file does not match checksum

I recently upgraded my local yum repository server to RHEL6. After upgrading I noticed the below error when my el5 clients would attempting to install packages from the local repo with yum.

[Errno -1] Metadata file does not match checksum Trying other mirror

As it turns out the default checksum type was changed when upgrading to the newer version of createrepo available on my el6 system. The default was changed from sha to sha256 which causes an incompatability with the older rhel5 clients. Here’s an excerpt from the createrepo man page:

-s --checksum
Choose the checksum type used in repomd.xml and for packages in the metadata. The default is now "sha256" (if python has hashlib). The older default was "sha", which is
actually "sha1", however explicitly using "sha1" doesn’t work on older (3.0.x) versions of yum, you need to specify "sha".

The fix lucikly was simple, I re-ran createrepo with the ‘–checksum sha’ option.

#Createrepo command compatible with older el5 systems

createrepo --checksum sha /path/to/repo

Then I ran a yum clean all on the client, just to be sure.

#clear cache on client system

yum clean all

And that’s it! My el6 yum repository is now happily serving both el5 and el6 clients.