YUM (Yellowdog Updater, Modified) is a package manager used on RPM-based Linux distributions (such as CentOS, RHEL, and Fedora) to install, update, and remove packages, and also provides options to fix YUM issues when they occur. While it’s a powerful tool, YUM can encounter issues like broken repositories, corrupted cache, missing dependencies, or other errors that can make package management difficult.
If you’re experiencing issues with YUM on your Linux server, this guide will help you troubleshoot and resolve those issues.
Preliminary Steps Before Fixing YUM Issues

Before diving into specific fixes, ensure that your YUM setup is in working condition.
Verify YUM is Installed
YUM is typically pre-installed on most Linux distributions, but it’s always good to verify if YUM is installed:
yum --version
If you don’t see the version information, you may need to install or reinstall YUM using your package manager.
For CentOS/RHEL 7 and newer, YUM is replaced by dnf
, which is backward compatible with YUM commands.
To check if dnf
is installed:
dnf --version
Check Your Internet Connection
A common issue with YUM is a network problem. If your server can’t reach the repositories, YUM will fail to update or install packages. Ensure that your server can access the internet and reach the repository servers.
Test the connection:
ping google.com
If you can’t reach external servers, check your network settings, firewall, and DNS configuration.
Check YUM Repositories
YUM relies on repositories to download packages. Incorrect repository configurations can cause issues. The repository configurations are located in /etc/yum.repos.d/
. You can view the list of repositories by:
ls /etc/yum.repos.d/
Each file in this directory corresponds to a repository configuration (e.g., CentOS-Base.repo
). Open one of the repository files to check the configurations:
cat /etc/yum.repos.d/CentOS-Base.repo
Ensure the repository URL is correct and that the repository is reachable.
Identifying Common YUM Issues
There are several common issues you might encounter with YUM:
- Broken or Corrupted YUM Cache
YUM maintains a local cache to speed up future operations. If this cache becomes corrupted, YUM may fail to install or update packages.
- Missing Dependencies
Sometimes, YUM fails due to missing dependencies or conflicts between package versions.
- Repository Issues
YUM relies on repository files in /etc/yum.repos.d/
. If the repository URLs are outdated or incorrect, YUM may fail to find packages.
- YUM Package Manager Not Responding
YUM may become unresponsive or slow due to a large number of packages being installed or updated at once.
- YUM Errors During Installation or Updates
YUM might return errors such as “package not found” or “unable to resolve host.”
Fix YUM Comman Issue on Linux Server: Step-by-Step Solutions
Let’s go through solutions to fix the most common YUM issues.
Clear YUM Cache
A corrupted cache can prevent YUM from working correctly. You can clear the cache using the following command:
sudo yum clean all
This will clean up all cached data and force YUM to fetch fresh metadata from the repositories.
After cleaning the cache, try running the update or installation again:
sudo yum update
Fix YUM Missing Dependencies
Sometimes, YUM can fail due to missing dependencies, especially if a package requires a different version of a library or another package.
- Check for Dependency Issues:
Use the yum deplist
command to check for missing dependencies for a specific package:
yum deplist <package-name>
- Install Missing Dependencies:
If a dependency is missing, install it manually:
sudo yum install <dependency-package>
Alternatively, you can use yum groupinstall
to install a group of packages:
sudo yum groupinstall "Development Tools"
Check and Fix YUM Repository Issues
If you’re having trouble with repositories (e.g., “repository not found” or “unable to reach repository”), you need to verify and correct the repository configurations.
- Check Repository Status:
To list the enabled repositories, run:
yum repolist
If a repository is missing or disabled, check the corresponding .repo
file in /etc/yum.repos.d/
.
For example, to check the CentOS repository configuration, open /etc/yum.repos.d/CentOS-Base.repo
:
sudo nano /etc/yum.repos.d/CentOS-Base.repo
Ensure the repository URL is correct and points to a valid mirror. You can often find updated repository URLs for CentOS or RHEL from the official documentation or mirror lists.
- Disable Broken Repositories Temporarily:
If a repository is causing issues, you can disable it temporarily by running:
sudo yum --disablerepo=<repo-name> update
Or, to permanently disable it, edit the .repo
file and set enabled=0
for that repository.
- Update Repository URLs:
If a repository URL is outdated or incorrect, update it to a working one. For example, you can replace the URL with a local mirror or use a public mirror from the official repository list.
- Fix GPG Key Issues:
If there are GPG key issues (e.g., “Public key for <package> is not installed”), import the GPG key:
sudo rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
Fix YUM Lock Issues
YUM might be locked due to another process running (like an automatic update or another YUM process). If you receive an error like “another yum process is running,” you can remove the lock files.
- Find and Kill the Process:
First, find the process ID of the running YUM process:
ps aux | grep yum
Then, kill the process:
sudo kill <PID>
- Remove Lock Files:
If the process is not running, but YUM is still locked, you can manually remove the lock files:
sudo rm -f /var/run/yum.pid sudo rm -f /var/run/yum.lock
After removing the lock files, try running YUM again:
sudo yum update
Update and Rebuild YUM Database
Sometimes, the YUM database may become corrupted or outdated. You can rebuild it to fix issues related to missing or outdated packages.
- Rebuild YUM Database:
sudo yum makecache
This will refresh the repository metadata and rebuild the cache, allowing YUM to function correctly.
- Update YUM Packages:
Run the following command to ensure that all packages are up-to-date:
sudo yum update
Fix Slow YUM Performance
YUM can sometimes be slow due to a large number of repositories or metadata. To improve performance:
- Disable Unnecessary Repositories:
Edit the repository configuration files in /etc/yum.repos.d/
and disable any repositories that are not needed. Set enabled=0
for those repositories.
- Use Fastest Mirror:
Enable the fastest mirror by editing /etc/yum.conf
and adding:
fastestmirror=true
This will allow YUM to automatically choose the fastest mirror for package downloads.
Reinstall YUM (if necessary)
If YUM is still not working properly and none of the above solutions resolve the issue, you may need to reinstall YUM.
For Debian/Ubuntu-based systems (using apt
):
sudo apt-get install --reinstall yum
For RHEL/CentOS-based systems:
sudo yum reinstall yum
After reinstalling, try running YUM again:
sudo yum update
Conclusion
Fixing YUM on a Linux server involves troubleshooting common issues like repository misconfigurations, broken caches, missing dependencies, and lock file problems. By following the solutions outlined in this guide, you can resolve most YUM-related issues and restore the package manager’s functionality. Regularly clear caches, monitor repository configurations, and check for system updates to ensure smooth operation of YUM.