How to Make YUM Ignore a Specific Dependency in CentOS/RHEL (nxagent vs nx Package Conflict)


2 views

When working with CentOS/RHEL systems, you might encounter situations where YUM's dependency resolution becomes too strict. A common scenario is when a package requires a dependency under one name (nxagent), but the equivalent functionality exists in your distribution under a different package name (nx in CentOS).

In this specific case with winswitch, the package expects nxagent to be installed, but:

  • CentOS provides the equivalent functionality through the nx package
  • --skip-broken is too broad as it skips the entire installation
  • Manual dependency resolution would be ideal

The most effective way to handle this is by temporarily excluding the specific dependency:

sudo yum install winswitch --exclude=nxagent

This tells YUM to proceed with the installation while ignoring the nxagent dependency check specifically.

If you frequently need to ignore this dependency, you can add it to YUM's configuration:

echo "exclude=nxagent" | sudo tee -a /etc/yum.conf

Remember to remove this line later if you want YUM to resume checking for nxagent in future installations.

After installation, verify that winswitch works correctly with the nx package:

rpm -q winswitch
rpm -q nx
winswitch --version

This technique works for other package/dependency mismatches too. For example, if a package requires python-requests but you have python2-requests installed:

sudo yum install some-package --exclude=python-requests
  • Only exclude dependencies when you're certain the alternative package provides equivalent functionality
  • Document these exceptions in your system administration notes
  • The excluded dependency won't receive updates automatically
  • Consider creating a local repository with corrected dependencies for production environments

When working with CentOS/RHEL systems, you might encounter situations where a package requires a dependency with a different name than what's available in your repositories. A classic example is when trying to install winswitch, which lists nxagent as a requirement, while the actual package in CentOS/RHEL repositories is named nx.

The --skip-broken option is too broad for this case - it skips the entire package installation if any dependency is missing, rather than allowing you to ignore specific dependencies.

The proper way to handle this is by using yum-utils, which provides the yum-complete-transaction and package-cleanup tools. First, install it if you haven't already:

sudo yum install yum-utils

For a more permanent solution, you can modify the package requirements:


# Download the package
yumdownloader winswitch

# Extract it
rpm2cpio winswitch-*.rpm | cpio -idmv

# Edit the spec file (you'll need to rebuild it)
# Change the Requires: nxagent to Requires: nx

# Rebuild the package
rpmbuild -bb winswitch.spec

# Install your custom package
sudo yum localinstall ~/rpmbuild/RPMS/x86_64/winswitch-*.rpm

For a one-time installation, you can use:

sudo yum install --setopt=strict=0 winswitch

This relaxes the dependency checking, but use it cautiously as it affects all dependencies for this transaction.

For enterprise environments, consider setting up a local repository with properly versioned packages:


# Install createrepo
sudo yum install createrepo

# Create repository directory
mkdir /opt/local-repo

# Copy your custom RPMs
cp ~/rpmbuild/RPMS/x86_64/* /opt/local-repo/

# Create repository metadata
createrepo /opt/local-repo

# Create repo file
echo "[local-repo]
name=Local Repository
baseurl=file:///opt/local-repo
enabled=1
gpgcheck=0" | sudo tee /etc/yum.repos.d/local.repo

Remember that modifying dependencies can lead to unstable systems if not done carefully. Always test changes in a development environment first.