4

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.

gbjbaanb
  • 3,852
  • 1
  • 22
  • 27

2 Answers2

3

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.

Scott Pack
  • 14,717
  • 10
  • 51
  • 83
  • 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 04 '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
  • 2
    @Bastien974: It looks like rollback was removed with rpm-4.6.0 per http://www.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
2

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

rpm -Uvh foo.rpm --oldpackage
Brad Beyenhof
  • 544
  • 2
  • 7