Fixing Broken YUM on Cent OS 5.9

CentOS 5.9 comes with Python 2.4.3 installed. I installed a different Python version (2.7) and all hell broke loose. Yum stopped working with errors like a particular Python module was missing.

I searched for fixing this problem on various forums and found no useful help. Finally, I could fix it with following actions:

Delete conflicting Python

  • Search other Python distributions on your machine. Run $whereis python and delete all directories that point to any Python version but 2.4.
  • Delete contents of /usr/lib/python2.4/site-packages/yum/ by running $rm -rf /usr/lib/python2.4/site-packages/yum/*
  • Delete contents of /usr/lib/python2.4/site-packages/rpmUtils/*
  • You will start seeing errors as No module named yum now.

Install YUM

  • Figure out what yum version does your machine expects. $rpm -q yum.
  • On my machine, output was: yum-3.2.22-40.el5.centos
  • Unzip and build it.
  • $make
    • You might see following error:
      for d in rpmUtils yum etc docs po; do make PYTHON=python -C $d; [ $? = 0 ] || exit 1 ; done
      intltool-update –gettext-package=yum –pot
      make[1]: intltool-update: Command not found
      make[1]: *** [yum.pot] Error 127
      make[1]: Leaving directory `/root/work/packages/yum-3.2.22/po’
      make: *** [subdirs] Error 1
    • I fixed the above error by changing the yum-3.2.22/Makefile and removing dependency “po” in the first line. It is harmless. If you start installing the intltool rpm, it ends up in many dependencies. It looked futile to me.
    • Try make again. It will work now.
  • Now, do make install
  • This will copy yum related modules in your Python site-packages.

Install YUM dependencies

  • Now, visit this link
  • Look at CentOS 5.9 section and copy all lines for RPM installation in a file.
  • Add –force to each rpm installation request as follows:

$~/work/packages/yum-3.2.22# rpm -Uvh –force

  • yum should work now

  One thought on “Fixing Broken YUM on Cent OS 5.9

  1. February 23, 2015 at 1:12 PM

    great blog, but I am not able to run the commands in the following link
    I get this error
    rpm -Uvh –force
    error: skipping – transfer failed – Unknown or unexpected error

    Can you please help me?


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: