Yum update

Checking for Centos updates and fixes

Centos yum command has an option of check-update  which has a return code of 100 if there are updates together with a list of the updates. If there are no updates but the command worked then it returns 0.

I wrote a quick script to be run from cron to check for updates and send an email if they are any.

#!/bin/bash
# Checks for updates from Centos

MAILADDR=user@yourdomain
YUMTMPF=/var/tmp/yumcheck.$$

yum check-update  > $YUMTMPF  2>&1
RETCODE=”$?”
if  [ “$RETCODE”  -eq 100 ]
then
cat $YUMTMPF | mail -s  “There are Centos updates available on `hostname`” $MAILADDR

else
if   [ “$RETCODE” -ne 0 ]
then
{
cat $YUMTMPF | mail -s   ” Problems with yum check-updates on `hostname`” $MAILADDR
rm  $YUMTMPF
exit 1
}
fi
fi
rm $YUMTMPF
When I actually ran the yum update command I got some errors :-

Transaction Check Error:
file /usr/share/emacs/site-lisp/psvn.el from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5
file /usr/share/man/man1/svn.1.gz from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5
file /usr/share/man/man1/svnadmin.1.gz from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5
file /usr/share/man/man1/svnlook.1.gz from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5
file /usr/share/man/man5/svnserve.conf.5.gz from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5
file /usr/share/man/man8/svnserve.8.gz from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5
file /usr/share/xemacs/site-packages/lisp/psvn.el from install of subversion-1.5.5-0.1.el5.rf conflicts with file from package subversion-1.4.2-2.el5

Doing a rpm -qa | grep subversion

-bash-3.2# rpm -qa | grep subversion
subversion-1.5.0-0.1.el5.rf
subversion-1.4.2-2.el5

Showed two versions of subversion installed so I removed the older one :-

-bash-3.2# yum remove subversion-1.4.2-2.el5
Loading “fastestmirror” plugin
Setting up Remove Process
Loading mirror speeds from cached hostfile
* dag: apt.sw.be
* base: centosb2.centos.org
* updates: centosh2.centos.org
* addons: centosj3.centos.org
* extras: centosb2.centos.org
Resolving Dependencies
–> Running transaction check
—> Package subversion.i386 0:1.4.2-2.el5 set to be erased
–> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
subversion              i386       1.4.2-2.el5      installed         7.6 M

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

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing   : subversion                   ######################### [1/1]

Removed: subversion.i386 0:1.4.2-2.el5
Complete!

Looking at the Dependencies Resolved section it showed the RPM to be i386 whereas my system is X86_64 so that looked like it was the problem. The update worked after that successfully.

Had a problem today with yum update :-

Resolving Dependencies
–> Running transaction check
—> Package file.x86_64 0:4.17-15.el5_3.1 set to be updated
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 229, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 145, in main
(result, resultmsgs) = base.buildTransaction()
File “/usr/lib/python2.4/site-packages/yum/sqlitesack.py”, line 94, in _read_db_obj
setattr(self, item, _share_data(db_obj[item]))
TypeError: unsubscriptable object

A search on Google gave me the answer  :-

yum clean all

Afterwards I was able to do the yum update successfully

Leave a Reply

Your email address will not be published. Required fields are marked *