Found yum broken on a legacy CentOS 5.x server while installing updates. The error was:
root # yum update There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: No module named cElementTree Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.4.3 (#1, May 5 2011, 16:39:10) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq root #
The fix was actually pretty simple, you have an incorrect version of python-elementtree installed. You will need to get the proper version from the CentOS mirror (for your version of CentOS). Here is what I did for CentOS 5.7 on x86_64:
wget http://mirrors.usc.edu/pub/linux/distributions/centos/5.7/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm rpm -Uvh --oldpackage python-elementtree-1.2.6-5.x86_64.rpm
After that yum worked just fine! Note, if you’re still having trouble check /etc/redhat-release for your current version of CentOS and uname -a for your architecture type.