What's the best (ie foolproof and easy) mechanism for rolling back an rpm update using YUM?

I've not come across the problem where I upgrade something and later find I want to downgrade it, but I'd rather be prepared for when it does happen.

link|improve this question

75% accept rate
feedback

2 Answers

up vote 3 down vote accepted

This appears to be a fairly easy to follow procedure for doing it: Yum Rollback

It does involve making some configuration changes to yum, but seems pretty easy. To summarize the link:

  1. Add ‘tsflags=repackage’ to /etc/yum.conf
  2. Add ‘%_repackage_all_erasures 1’ to /etc/rpm/macros

And when you want to rollback use the ‘--rollback’ flag within rpm. Like I said, seems pretty brain dead easy.

link|improve this answer
now that really does look like the business. Why isn't that on by default?! – gbjbaanb May 31 '09 at 14:48
it's not by default because you have to have the old package for rpm or it won't work - rpms don't really "upgrade" or "patch", they reinstall with the new edition – warren Oct 4 '09 at 11:33
This works on my CentOs but not on FC, do you know why ? I got a "--rollback: unknown option" – Bastien974 Sep 28 '11 at 14:43
@Bastien974: It looks like rollback was removed with rpm-4.6.0 per rpm.org/wiki/Releases/4.6.0#Removedfeatures You're probably using CentOS 5, which uses rpm-4.4.2. Most likely you're using a release of Fedora that includes rpm-4.6 or higher. (Note that F15 is at v4.9.1) – Scott Pack Sep 28 '11 at 15:33
feedback

Just use the --oldpackage switch with the older rpm:

rpm -Uvh foo.rpm --oldpackage
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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