== RPM tricks for dealing with multiarch machines Why do we need some new RPM tricks for dealing with multiarch machines? Simple: > ; rpm -q glibc > glibc-2.5-10.fc6 > glibc-2.5-10.fc6 That's not an error, that's just my machine having both the 32-bit and the 64-bit glibc RPMs installed. On a multiarch machine it's routine to have RPMs with identical names, and _rpm_ itself hasn't been fully adapted for this situation. The big RPM trick for dealing with a multiarch machine is to know that you can pick out a specific architecture's RPM by putting the name of the architecture on the end of the name of the RPM: > ; rpm -q glibc.x86_64 > glibc-2.5-10.fc6 (You can use this format with _yum_ as well as with _rpm_.) The other trick is using RPM query formats to actually show you which architecture a specific RPM is for. Query formats are sufficiently complicated that a full explanation is well beyond the scope of this entry, but the basics are reasonably simple: > ; rpm --qf '%{NAME}.%{ARCH}\n' -q glibc > glibc.x86_64 > glibc.i686 The normal '_rpm -q_' output format is '%{NAME}-%{VERSION}-%{RELEASE}\n', or '%{N}-%{V}-%{R}\n' in the compact form (technically this is slightly incorrect because it omits the epoch, but that almost never matters). To add the architecture you use an explicit query format of '%{N}-%{V}-%{R}.%{ARCH}\n', and for many purposes just the name and the architecture is enough, so you can just use '%{NAME}.%{ARCH}\n'. (And the '\n' is important. Many a time I've accidentally left it out and gotten all of the output smashed together into one line.) There is probably something you can set up in your _.rpmmacros_ file to make _rpm_ use this query format by default, but I don't know it. You can just make a cover script instead, so you don't have to type the query format all the time: ; cat rpmq #!/bin/sh exec rpm --qf '%{N}-%{V}-%{R}.%{ARCH}\n' "$@" (My fingers are busy telling me that this should also supply the '_-q_' argument too, so I can just do '_rpmq kernel_' and it'll work.)