tip: automated way to delete duplicate rpms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I recently updated a server from fc3 to fc6.  All seemed to go well
except the first yum attempt to update the machine failed and when I
entered synaptic I received a ton of errors about duplicate rpms
installed on the machine.  I've run into this issue before.
Unfortunately neither yum nor synaptic has a way to deal with it, as far
as I can tell.   

Rather than manually go through the list of offending rpms and delete
them, I did things semi automatically.  There were 120 duplicate rpms on
my machine, so manually typing the full package names would have taken a
while.

Here is what I did instead.

1) Generate a list of all the rpm packages installed.

$rpm -qa --queryformat '%{name}\n' > pkglist

This generates an unsorted list that looks like this.
libavc1394
libmusicbrainz
ethtool
desktop-file-utils
less
time
libXrandr
rmt

2) Sort the list and find the duplicates

$sort -g pkglist | uniq -d > duplicates

This list will look like 

a2ps
anacron
at
audit
...

3) Generate a list of the packages with versions to look at and edit

I created a small script file called dupWithVersions with this in it

for pkg in `cat duplicates`; do
  rpm -q $pkg
done

Redirect the output to another file like this.  $dupWithVersions
>removeList

The remove list will look like this:

a2ps-4.13b-57
a2ps-4.13b-57.fc6.3
anacron-2.3-41.fc6
anacron-2.3-44.fc6
at-3.1.8-82.fc6
at-3.1.8-84.fc6
audit-1.2.8-1.fc6
audit-1.3-2.fc6

Go through the remove list and manually remove the versions you want to
KEEP !  Remember this is a list of rpms you want to remove !

4) Remove the rpms in the remove list.

To do this I generated a little script as follows:

for pkg in `cat removelist`; do
  rpm -e $pkg
done

This process quickly and correctly removed the duplicate rpms from my
machine. 

I hope this helps someone. 












 

-- 
Kim Lux,  Diesel Research Inc.


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux