In this tutorial, we will learn about How to resolve the error “Another app is currently holding the yum lock; waiting for it to exit”. This issue is encountered by users on CentOS, RHEL, and other RPM-based Linux distributions. The error indicates that a process involving the package manager Yum is already in progress, and the system is waiting for it to complete before proceeding with the requested operation. This problem can occur due to various reasons, such as an interrupted upgrade process or another instance of Yum running concurrently. Resolving this issue requires understanding the causes and implementing appropriate solutions. We will learn about the error and its fix in depth in the upcoming section of this tutorial.
Why the Error Occurred?
In some of the Linux distributions like RHEL/CentOS 7, yum is the package manager which is used to install the packages in the system. The error “Another app is currently holding the yum lock” generally occurs when the yum command is already running in the background i.e. Yum process is in execution mode. There are several ways to find out if yum process is already invoked in the background which prevents the invocation of any new yum process. We will fix this error using few ways which are covered in the upcoming sections of this tutorial.
[Solved] Another app is currently holding the yum lock; waiting for it to exit
Also Read: How to Install R on Rocky Linux [Step by Step Guide]
There are few ways to fix the error. We will look at different ways to address and fix the issue based on the scenario under which the issue was observed or occurred. Before we jump into the solution, let us reproduce the issue and try to understand why the error has occurred in the next section.
Reproduce Error
The error “Another app is currently holding the yum lock” generally seen during the execution of yum commands. For example, if you update the yum repository using the command yum update or you are trying to install a package say nmap using the command yum install -y nmap
. When I was trying to install the nmap package in my system, I got exactly the same error as shown below.
[[email protected] ~]# yum install -y nmap Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Existing lock /var/run/yum.pid: another copy is running as pid 14696. Another app is currently holding the yum lock; waiting for it to exit... The other application is: yum Memory : 40 M RSS (1.2 GB VSZ) Started: Wed Dec 6 22:28:05 2023 - 02:39 ago State : Traced/Stopped, pid: 14696 Another app is currently holding the yum lock; waiting for it to exit... The other application is: yum Memory : 40 M RSS (1.2 GB VSZ) Started: Wed Dec 6 22:28:05 2023 - 02:41 ago State : Traced/Stopped, pid: 14696
Solution-1: Kill Yum Running Process
Also Read: yum config manager command not found [Solved]
The first thing you should look for is to check if there is any yum command which is running in the background. Ideally, in a system, at a time only one yum command can be executed. If you will try to punch another yum command with the completion os already running yum command, you will see the error. List the running process using command ps -ef
. After the command use pipe(|
) and append grep yum to only filter out the yum processes as shown in below steps.
Step-1: List Running Processes
[[email protected] ~]# ps -ef | grep yum root 14696 14540 0 22:28 pts/1 00:00:00 /usr/bin/python /usr/bin/yum install -y gpart root 14901 14540 0 22:31 pts/1 00:00:00 grep --color=auto yum
Step-2: Kill the Process
If there is any zombie process found , kill the process using kill -9 <process-id>
command. The zombie processes are the processes which are stuck and have occupied the resource.
[[email protected] ~]# kill -9 14696
Step-3: Verify if Process is Killed
You can re-run the command to make sure that no other yum processes are currently running in the background.
[[email protected] ~]# ps -ef | grep yum root 15011 14540 0 22:33 pts/1 00:00:00 grep --color=auto yum [1]+ Killed yum install -y gpart
Step-4: Install the rpm
To validate the solution, try to now install any package in the system. I have installed nmap. If there are no further error, nmap package will successfully get installed in the system.
[[email protected] ~]# yum install -y nmap
Solution-2: Delete Yum Lock File
Whenever you invoke any yum command, it create a lock file. This lock file is created in the path ”/var/run/yum.pid“. The content of “yum.pid” file is the PID of currently running yum process. If you cat the file, you will see its content, you will find that it stored the PID of the currently running yum process.
[[email protected]~]# cat /var/run/yum.pid 14662
Next, delete the lock file, it will free up the yum lock
[[email protected]~]# rm /var/run/yum.pid
Next, you can now install any new package
[[email protected] ~]# yum install -y tcpdump
Solution-3: Reboot System
If non of the above solution works , reboot the system so that if there is any zombie processes which are not visible from our regular command, it will get cleaned up post the system reboot. Please note, before rebooting the system make sure you have all your activates saved so that it does not get lost with reboot. You can use below command to reboot the system.
[[email protected] ~]# reboot
Summary
We have successfully fixed the error using one of the solution given in this article. Yum is a strong tool which makes the package installation and management quite easy and convenient for the end user.