On Wed, 2004-11-17 at 12:12, mw-list-yum@xxxxxx wrote: > 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 if this is yum 2.1.X you can specify complete versions on the cli yum remove foo-1.1-1 -sv