Tuesday, June 27, 2017

How to Resolve YUM Lock Issue : Another app is currently holding the yum lock; waiting for it to exit...

If you are Linux user or System Administrator then you might face below issue while trying to use YUM command for software package management. It's a very common issue.

The error states that :
Existing lock /var/tmp/yum-vagrant-qt0qu8/x86_64/6/yum.pid: another copy is 
running as pid 5025.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  20 M RSS (310 MB VSZ)
    Started: Mon Jun 26 10:49:35 2017 - 00:14 ago
    State  : Traced/Stopped, pid: 5025
This error message tells us two things:
  • There is another yum instance running by some processes that are holding the lock.
  • The origin of this situation implies that the system does not support YUM concurrent operations.
This is "How To" guide in which we would discuss the solution / workaround of this problem.

Solution 1

From the error message, it's clear that there is an existing lock on yum.pid file. Therefore if we would remove the respective file then the problem would get resolved automatically.
~]$ rm -f /path/to/yum.pid

Solution 2

Find out which process is locking up the yum and then kill that process.
~]$ ps -ef | grep yum     //Finding the process
~]$ kill -9 [insert pid]  //Killing the process   

Solution 3

This type of circumstance usually occur when yum-updatesd (update notifier daemon) is running. One may solve it using below commands:
~]$ service yum-updatesd stop
~]$ service yum-updatesd start
This only works if yum-updatesd is locking the system.

Solution 4 

Sometimes on CentOS, Fedora or RHEL, one might get error message like
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
It's happening due to PackageKit which is responsible for auto updates on Red Hat based systems. The PackageKit process gets automatically started upon boot, holding the yum lock.

To fix the error, one might simply wait for PackageKit to finish, and then run yum command again or disable the PackageKit, so that it won't perform auto update checks in the background and blocks yum.

This is how one can disable the PackageKit on Red Hat based system.
#Temporarily Disabling PackageKit 
~]$ sudo yum install --disableplugin=refresh-packagekit  

#Permanently Disabling PackageKit On CentOS/RHEL 7, Fedora 20 or higher
~]$ sudo systemctl disable packagekitd   //disable permanently in next boot

#Permanently Disabling PackageKit On CentOS/RHEL 6, Fedora 19 or earlier
~]$ vi /etc/yum/pluginconf.d/refresh-packagekit.conf  //open with any text editor
enabled=0   //change "enabled=1" to "enabled=0" 

#Remove the PackageKit package from the system 
~]$ sudo yum remove PackageKit //after resolving the issue, for future

Note: It is advisable to simply wait if some process is holding yum lock, and only as a last resort, if one thinks that the process is dead and unresponsive then only one should use these approaches.

Thank you for reading this article. Hope your yum lock issue will get resolved. If you face any other yum related issue or have any suggestion or question do let me know in the comment box. Happy Learning!!😀

No comments:

Post a Comment