[Yum] removing duplicate entries

mw-list-yum at csi.hu mw-list-yum at csi.hu
Wed Nov 17 17:12:52 UTC 2004


While yum was updating packages, I ran 'rpm -qa' and it made both
processes hang (left them alone for 30 minutes).  After removing the
__db* files and killing the processes, I was left with duplicate
entries, such as

a2ps-4.13b-37
a2ps-4.13b-41
acl-2.2.23-5
acl-2.2.7-5
alchemist-1.0.33-1
alchemist-1.0.34-1

All these packages are reported updated by yum, so I'd like to remove
the old packages from the rpm database---with yum.  Is there a
reliable way  of  doing this?  I plan on doing something like:

1) collect the duplicate packages' names with 

rpm -qa|sort|awk  '{ sub("-[^-]*-[^-]*$", "");  print}'|uniq -d

2) For each package obtained in 1) find the old  versions with 

rpm -q $package | sort -n|  awk '{version[NR]=$0}; END{for(i=1;i<NR;i++) print version[i]}'

and list them in the file old_list.

3) Remove these old packages with 

cat old_list | xargs yum  -y remove  

Mate
-- 
---
Mate Wierdl | Dept. of Math. Sciences | University of Memphis  
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html



More information about the Yum mailing list