Friday, May 25, 2012

How To Downgrade Or Reinstall RPM Package

I had this issue yesterday when I was playing with Fedora 17 Beta. Here is what happened:
1. I installed Fedora 17 Beta and did a yum update.
2. I installed some common things like vim and tree.
3. I tried to install rpm-build and rpmdevtools.


As soon as I did the third step, yum spit out an error saying that the version of "rpm" package I have is newer that what is required. Now there is a problem. Had it been any other package, I could simply have uninstalled the newer version by doing a yum erase and have installed the required version but what do I do now? If I uninstall rpm package then how will I install rpm package again? Yum itself uses rpm in the backend. I wasn't able to find any "force" flag for yum.

A simple solution to the problem above is to use rpm command instead of using yum. Go any of the mirrors and download the rpm package. Now you have the package use "--force" flag and install if via rpm command.


rpm -ivh --force rpm-4.9.1.3-6.fc17.x86_64.rpm

The trick worked well and I was able to resume work.

6 comments:

  1. Even better with yum:

    yum downgrade /path/yourpackage.rpm

    ReplyDelete
    Replies
    1. yeah. It may work. I haven't tried though I agree that it would be a better way since it'll resolve the deps too.

      Delete
  2. I usually recommend that you need a note from your mom to use: rpm --force

    In your case, something better to use includes:
    rpm -Uvh --oldpackage foo.rpm

    (or yum downgrade as suggested too)

    ReplyDelete
    Replies
    1. "I usually recommend that you need a note from your mom to use: rpm --force"

      LOL

      Delete
  3. dont forget yum history and yum history undo

    however, you must use yum all the time for this, no more rpm -i etc

    Hope that helps

    ReplyDelete

Note: Only a member of this blog may post a comment.