How To Remove i386 RPM Package from x86_64 Install

In this how to I will describe how to remove any i386 RPM Package from your x86_64 version of install. The operating system can be RHEL, Fedora or CentOS. Sometimes using yum we accidentally or intentionally or as requirement we install i386 rpm package on our x86_64 install of RHEL, Fedora or CentOS.

This can be either library or full package itself. We came to issue of upgrading PHP while it require to upgrade MySQL server. By issueing yum upgrade command stuck with conflict with already i386 version of install. By checking we found out both i386 and x86_64 version of rpm were install of MySQL. There is option available in rpm command to remove both of them. But our requirements is to remove only i386 version of MySQL rpm.

1) Get a List of i386 RPMs for MySQL

If I do only

rpm -qa | grep mysql

mysql-5.0.77-4.el5_5.4
mysql-5.0.77-4.el5_5.4
mysql-server-5.0.77-4.el5_5.4
mysql-server-5.0.77-4.el5_5.4
mysql-devel-5.0.77-4.el5_5.4
mysql-devel-5.0.77-4.el5_5.4

will give me both install of mysql with same name. So I will give it queryformat option to get out only i386 version of MySQL

rpm -qa –queryformat=’%{n}-%{v}-%{r}.%{arch}\n’ | grep ‘\i[3456]86$’ | grep mysql

mysql-5.0.77-4.el5_5.4.i386
mysql-server-5.0.77-4.el5_5.4.i386
mysql-devel-5.0.77-4.el5_5.4.i386

The above command will bring MySQL rpm of i386 version install.

2) Delete the i386 rpm.

Now you can issue individual command to remove the found i386 rpm files.

rpm -e mysql-5.0.77-4.el5_5.4.i386
rpm -e mysql-server-5.0.77-4.el5_5.4.i386
rpm -e mysql-devel-5.0.77-4.el5_5.4.i386

The architecture at the end will cause only i386 version of rpm to delete.

3) Delete all i386 RPM Found.

If you wish you can delete all i386 RPM files found on your x86_64 install of RHEL, Fedora or CentOS. You can use following command to do so.

rpm -qa –queryformat=’%{n}-%{v}-%{r}.%{arch}\n’ | grep ‘\.i[3456]86$’ | xargs rpm -ev

If you have any question please comment.

Related Posts

Leave a Reply

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