Friday, August 14, 2009

Yum and RPM notes for multiarch machines

When installing something on a stock 64bit installation, yum will by default install both x86_64 and i386 (if available) packages. This default behavior is often appearing when installing libraries and can be changed
by adding the following to /etc/yum.conf

multilib_policy=best

(default to all). In this way only the matching arch package will be installed.

If you don't want to make this global change, you can issue the yum command as follows to have the same outcome but for one time only:

yum install libtool-ltdl.x86_64

i.e. append the arch to the package name to avoid i386 package to be pulled along.

Querying the rpm database on x86_64 machines often shows duplicate packages, but that's normal in light of the above. You can change the default query format on the fly, e.g

rpm --qf '%{NAME}.%{ARCH}\n' -q glibc

or you can make it global by adding this to /etc/rpm/macros
%_query_all_fmt         %%{name}-%%{version}-%%{release}.%%{arch}
In this way the arch will be shown alongside other query parameters.