Duplicate Packages

Matthew Saltzman mjs at ces.clemson.edu
Tue Mar 13 23:12:25 UTC 2007


On Tue, 13 Mar 2007, oldman wrote:

> jim tate wrote:
>> What command could I use to show me duplicate packages of RPM's ,
>> with different version numbers.
>> Yum isn't taking out older versions of some packages when updating,
>> and it causes problem when updating
>> .
>> Jim
>>
> Hi Jim.
>
> A look through the archives gave me this:
>
> There is a tool available to solve duplicate package problems: see
> https://lists.dulug.duke.edu/pipermail/yum/2006-December/009451.html
>
> as well as this:
>
>
> rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort
>
> which will sort all your packages with the ones with the most packages
> at the bottom

I think it sorts by name and you have to scan the list for dups.

It inspired me to try this, though:

 	rpm -qa --qf '%{name}\n' | sort | uniq -d

Prints just the name, sorts the output by name, then prints only 
duplicated names.  As there is no version number, packages installed twice 
with different version numbers will show up as dups.  If you have no 
problem, you should see:

$ rpm -qa --qf '%{name}\n' | sort | uniq -d
gpg-pubkey
kernel
kernel-devel

(Maybe not the kernel-devel if you don't build your own modules, maybe 
kmod-* packages if you use them.)

>
> when you get the list you may be tempted to erase the older package,
> but you had best use the --justdb option as deleting an old rpm will
> very likely want to erase dependencies as well as the files it has in
> common with the newer package. just be sure to 'rpm -e --justdb
> package-1<older.pkg.version>

I always wondered if you were guaranteed that the only files related to 
that package were from the new version.  You might want to

 	rpm -qV <package>

after you do the remove and make sure that the remaining files verify 
against the new package.  That still won't guarantee that there are not 
files left behind from the old package though.

-- 
 		Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs




More information about the fedora-list mailing list