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}\n” | 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

2 thoughts on “Duplicate RPM names showing up in the rpm query output”

  1. You could also use yum for that kind of stuff, though it can be a lot slower..

    # yum list glibc
    [lots of yum output]
    glibc.i686 2.5-24.el5_2.2 installed
    glibc.x86_64 2.5-24.el5_2.2 installed

Leave a Reply

Your email address will not be published. Required fields are marked *