If you cannot update your OS via YUM, there are some common problems that exist across all Red Hat based operating systems. Here are some of the problems and their fixes.

 

“Existing lock /var/run/yum.pid: another copy is running. Aborting.” or
“Another app is currently holding the yum lock; waiting for it to exit…”

This error occurs for one of three reasons.

1) Another user could be logged into root executing YUM commands simultaneosly.
2) The YUM update daemon is automatically applying updates in the background.
3) YUM may have stopped responding from the last time it was executed and a PID file still remains.

To resolve the problem you can kill all the YUM processes, delete the PID file and turn off the YUM update daemon. To do so execute the following commands as the root user.

# service yum-updatesd stop
# killall -9 yum ; killall -9 yum-updatesd
# chkconfig yum-updatesd off
# rm -f /var/run/yum.pid

 

“Cannot find a valid baseurl for repo:”

This error occurs when the repositories in your /etc/yum.repos.d/ directory are not reachable. There are two main reasons why this may occur.

1) DNS is not resolving domain names to an IP address.
2) Your OS has reached it’s end of life for support and the repository is no longer available.

To find out if the DNS is an issue look in your /etc/yum.repos.d/ files and try to resolve an IP to any of the hostnames. For example, CentOS 5 contains the mirrorlist.centos.org repository by default. Check for DNS resolution with the following command in this example.

# dig mirrorlist.centos.org +short
72.232.223.58
204.15.73.243

If you are able to resolve an IP to the domain name listed in the yum.repos.d directory then your OS could be at the end of it’s support life cycle.