Sunday, January 13, 2008

How to downgrade part of a yum repository

(skip down to avoid the rambling...)

I've been running Zimbra 4.0.x/4.5.x on CentOS 4.x for over a year now on a couple different servers without a hiccup, although Zimbra will tell you that CentOS is NOT a supported platform. Of course, RHEL4/5 are officially supported. I dutifully ran each Zimbra upgrade (with full backup prior) and never had a problem, but for Zimbra 5.0, I decided to be cautious. Zimbra 5.0 was released on 12/31/2007 (really trying to be able to say it was released in Q4 '07). Clearly, Zimbra was in a bit of a hurry to get it out the door, and as it was a rather substantial upgrade, I decided to wait until at least 5.0.1.

Sure enough, shortly after the 5.0 release, the Zimbra forums started popping with upgrade problems, which was finally tracked down to a bad interaction with Zimbra and the version of perl (5.8.8) that comes with Red Hat Application Server and CentOS Plus. The stock version of perl is 5.8.5. After checking my Zimbra servers, sure enough, I had the CentOS Plus version of perl installed (not sure why I had done that, but the machines were installed a couple of years ago...)

Several people on the forums were using the following to force install, but that didn't pass the sniff test and would break the first time perl RPM was updated:
$ perl -MCPAN -e shell
force install Scalar::Util

Useful part of story (--nodeps is your friend)

My first pass at this, I thought I'd just remove the perl rpm, fixup the CentOS Plus repository to ignore perl and install the correct version of perl for Zimbra. So, I wanted to see what kind of dependency hell I'd be in if I didn't force anything:
$ perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
$ sudo yum remove perl
Transaction Summary
Install 0 Package(s)
Update 0 Package(s)
Remove 223 Package(s)
Hmm, plan B? Using 'rpm -e --force' is the quickest way to trash your RPM database, so I wasn't doing that. Fortunately, a more experienced user on the forums suggested just using rpm to uninstall perl with the --nodeps flag.
$ sudo rpm -e --nodeps perl
Nice, that got rid of perl-5.8.8 (also uninstall perl-suid if installed).

Then edit the CentOS Plus repository config to permanently ignore it's version of perl.
$ sudo vi /etc/yum.repos.d/CentOS-Base.repo
(insert 'exclude=perl*' under the [centosplus] section)
Now reinstall perl, and you are good to go.
$ sudo yum install perl
$ perl -v
This is perl, v5.8.5 built for i386-linux-thread-multi


Check for /usr/lib/perl5/5.8.8/ directory. It shouldn't exist, but if it does, you probably installed code from CPAN and need to reinstall the appropriate 5.8.5 code.

No comments: