How to Temporarily Override Yum Exclude List for 32-bit Package Installation on RHEL 5.x


2 views

When managing RHEL 5.x systems with custom repositories, you might encounter package conflicts between 32-bit and 64-bit architectures. The common solution of adding exclude=*.i386 to /etc/yum.conf works well until you need to install a 32-bit only package like compat-libstdc++-296.i386.

Yum provides a built-in way to temporarily bypass exclusion rules without editing configuration files. The --disableexcludes flag is your solution:

yum install compat-libstdc++-296.i386 --disableexcludes=all

The --disableexcludes parameter accepts several values:

--disableexcludes=all    # Disables all excludes
--disableexcludes=main   # Disables only excludes from [main] in yum.conf
--disableexcludes=repoid # Disables excludes for specific repository

For managing 300 servers, you can use SSH with a simple script:

for server in $(cat server_list.txt); do
    ssh root@$server "yum install -y compat-libstdc++-296.i386 --disableexcludes=all"
done

If you prefer a configuration-based approach, use this one-liner:

sed -i 's/^exclude=.*/#&/' /etc/yum.conf && \
yum install -y compat-libstdc++-296.i386 && \
sed -i 's/^#exclude=.*/exclude=*.i386/' /etc/yum.conf
  • This method works on RHEL 5.x through 8.x
  • Always test in a non-production environment first
  • Consider creating a local repository for frequently needed 32-bit packages

When managing RHEL 5.x systems with custom repositories, administrators often need to exclude 32-bit packages to prevent conflicts with x86_64 architectures. The standard approach is adding:

exclude=*.i386

to /etc/yum.conf. While effective for most cases, this becomes problematic when you specifically need to install 32-bit packages like compat-libstdc++-296.i386.

Yum provides a built-in solution through its --disableexcludes flag. This parameter accepts four values:

yum install package --disableexcludes=[main|repoid|all]

For our specific case with compat-libstdc++-296.i386, the command would be:

yum install compat-libstdc++-296.i386 --disableexcludes=main

For large-scale deployments across 300+ servers, consider these approaches:

# SSH parallel execution example
pssh -h server_list.txt -i "yum -y install compat-libstdc++-296.i386 --disableexcludes=main"

Or using Ansible:

- name: Install 32-bit package with exclusion override
  yum:
    name: compat-libstdc++-296.i386
    disable_excludes: main
    state: present

For more granular control, modify repository configs instead of the global yum.conf:

[custom-repo]
name=Custom Repository
baseurl=http://repo.example.com
enabled=1
exclude=*.i386

This allows overriding exclusions per-repository while keeping the global config clean.

After installation, verify the package architecture:

rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | grep compat-libstdc++

Common issues include:

  • Conflicting dependencies still present
  • Incorrect --disableexcludes parameter (use 'all' if unsure)
  • Repository metadata needing refresh