Excluding Packages from Yum Updates

There may be times when you may need to exclude packages from yum updates — e.g. package conflicts, etc. I always like to give an example of why I would do this or that, so for an example pertaining to excluding packages it’s as simple as something is installed and the RPM’s of that conflict with the RPM’s yum wants to install and yum won’t install them because it doesn’t want to break the system. This in turn can keep unrelated packages from installing and then it can become one big mess. Did that run-on sentence make any sense? Ok, this is it in action…

[root@linux ~]# yum update
fedora                    100% |=========================| 2.1 kB    00:00
primary.sqlite.bz2        100% |=========================| 3.8 MB    00:03
updates                   100% |=========================| 2.3 kB    00:00
primary.sqlite.bz2        100% |=========================| 2.4 MB    00:02
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package perl.i386 4:5.8.8-28.fc7 set to be updated
---> Package perl-libs.i386 4:5.8.8-28.fc7 set to be updated
---> Package perl-ExtUtils-MakeMaker.i386 0:6.30-28.fc7 set to be updated
---> Package perl-CPAN.i386 0:1.76_02-28.fc7 set to be updated
---> Package perl-ExtUtils-Embed.i386 0:1.26-28.fc7 set to be updated
---> Package perl-Test-Simple.i386 0:0.62-28.fc7 set to be updated
---> Package perl-devel.i386 4:5.8.8-28.fc7 set to be updated
---> Package perl-Test-Harness.i386 0:2.56-28.fc7 set to be updated
filelists.sqlite.bz2      100% |=========================| 6.4 MB    00:05
filelists.sqlite.bz2      100% |=========================| 5.3 MB    00:04
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Updating:
 perl                    i386       4:5.8.8-28.fc7   updates            10 M
 perl-CPAN               i386       1.76_02-28.fc7   updates           127 k
 perl-ExtUtils-Embed     i386       1.26-28.fc7      updates            34 k
 perl-ExtUtils-MakeMaker  i386       6.30-28.fc7      updates           288 k
 perl-Test-Harness       i386       2.56-28.fc7      updates            78 k
 perl-Test-Simple        i386       0.62-28.fc7      updates           109 k
 perl-devel              i386       4:5.8.8-28.fc7   updates           384 k
 perl-libs               i386       4:5.8.8-28.fc7   updates           567 k

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       8 Package(s)
Remove       0 Package(s)

Total download size: 12 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): perl-Test-Harness- 100% |=========================|  78 kB    00:00
(2/8): perl-devel-5.8.8-2 100% |=========================| 384 kB    00:00
(3/8): perl-Test-Simple-0 100% |=========================| 109 kB    00:00
(4/8): perl-ExtUtils-Embe 100% |=========================|  34 kB    00:00
(5/8): perl-CPAN-1.76_02- 100% |=========================| 127 kB    00:00
(6/8): perl-ExtUtils-Make 100% |=========================| 288 kB    00:00
(7/8): perl-libs-5.8.8-28 100% |=========================| 567 kB    00:00
(8/8): perl-5.8.8-28.fc7. 100% |=========================|  10 MB    00:09
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test

Transaction Check Error:
  file /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/MIME/Base64/Base64.so from install of perl-5.8.8-28.fc7 conflicts with file from package perl-MIME-Base64-3.07-1
  file /usr/share/man/man3/MIME::Base64.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-MIME-Base64-3.07-1
  file /usr/share/man/man3/MIME::QuotedPrint.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-MIME-Base64-3.07-1
  file /usr/lib/perl5/5.8.8/Getopt/Long.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Getopt-Long-2.36-1
  file /usr/lib/perl5/5.8.8/newgetopt.pl from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Getopt-Long-2.36-1
  file /usr/share/man/man3/Getopt::Long.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Getopt-Long-2.36-1
  file /usr/lib/perl5/5.8.8/Math/BigFloat.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/lib/perl5/5.8.8/Math/BigInt.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/lib/perl5/5.8.8/Math/BigInt/Calc.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/lib/perl5/5.8.8/Math/BigInt/CalcEmu.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/share/man/man3/Math::BigFloat.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/share/man/man3/Math::BigInt.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/share/man/man3/Math::BigInt::Calc.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/share/man/man3/Math::BigInt::CalcEmu.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigInt-1.86-1
  file /usr/lib/perl5/5.8.8/Math/BigRat.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigRat-0.19-1
  file /usr/share/man/man3/Math::BigRat.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Math-BigRat-0.19-1
  file /usr/lib/perl5/5.8.8/bigint.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-bignum-0.21-1
  file /usr/lib/perl5/5.8.8/bignum.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-bignum-0.21-1
  file /usr/lib/perl5/5.8.8/bigrat.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-bignum-0.21-1
  file /usr/share/man/man3/bigint.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-bignum-0.21-1
  file /usr/share/man/man3/bignum.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-bignum-0.21-1
  file /usr/share/man/man3/bigrat.3pm.gz from install of perl-5.8.8-28.fc7 conflicts with file from package perl-bignum-0.21-1
  file /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Sys/Syslog.pm from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Sys-Syslog-0.18-1
  file /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Sys/Syslog/Syslog.so from install of perl-5.8.8-28.fc7 conflicts with file from package perl-Sys-Syslog-0.18-1

Error Summary
-------------

[root@linux ~]#

I ran a yum update and a bunch of perl updates crapped out. MailScanner is the only application I installed that loaded a series of perl RPM dependencies, so it’s safe to assume that MailScanner is the culprit. With that said, I’ll get to the point of this post. If you have a similar problem with yum updates failing, you can exclude those updates.

For RedHat based systems (Fedora & CentOS), you’ll want to edit the updates repository file.

[root@linux ~]# cd /etc/yum.repos.d/
[root@linux yum.repos.d]# ls
fedora-development.repo  fedora.repo  fedora-updates.repo  fedora-updates-testing.repo
[root@linux yum.repos.d]# nano fedora-updates.repo

On my Fedora 7 system, the file I want to edit is fedora-updates.repo (your file name may be different depending on the distro and release you’re using).

In the updates section, add an exclude line like in the example below. I’m excluding all updates that begin with the word perl (note the wildcard *). To exclude more than one set, enter each package name on the same line and separate them with a space.

[updates]
name=Fedora $releasever - $basearch - Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
exclude=perl*

Now if I run the yum update, all packages beginning with “perl” should be excluded.

[root@linux yum.repos.d]# yum update
updates                   100% |=========================| 2.3 kB    00:00
Excluding Packages from Fedora 7 - i386 - Updates
Finished
Setting up Update Process
No Packages marked for Update
[root@linux yum.repos.d]#

Now we’re cool. If you didn’t know how to exclude packages from yum updates, well now you know.

This entry was posted in CentOS, Fedora, Linux and tagged , , , . Bookmark the permalink.