Duplicate RPM names showing up in the rpm query output


I had to install some software last night on one of my 64-bit CentOS Linux hosts, and noticed that glibc was listed twice in my rpm query:

$ rpm -q -a | grep glibc-2.5-34

glibc-2.5-34
glibc-2.5-34

At first I thought my RPM package database was borked, but then it dawned on me that there are probably 32- and 64-bit packages installed. To verify this, I used a custom rpm query string that displayed the archiecture in addition to the package name and version:

$ rpm -qa --qf "%{name}-%{version}-%{release}.%{arch} " | grep

glibc-2.5-34**
glibc-2.5-34.i686
glibc-2.5-34.x86_64

This was indeed the case, and a full listing of each package showed that 32-bit libraries went into /lib, and 64-bit libraries got stashed into /lib64. I’m not sure why the default rpm query output doesn’t contain the package architecture, but it appears adding the following entry to /etc/rpm/macros fixes this (credit to the CentOS mailing list for the macro):

$ ` grep query /etc/rpm/macros

%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}`

$ rpm -q -a | grep glibc-2.5
glibc-2.5-34.i686 glibc-2.5-34.x86_64

This article was posted by Matty on 2009-05-19 09:46:00 -0400 -0400