Today we will be discussing how to fix a simple error namely “Existing lock /var/run/yum.pid: another copy is running as pid” while we trying to install a package using yum. This is very common and simple error to resolve.
Example:
yum install samba
Sample output:
Loaded plugins: fastestmirror Existing lock /var/run/yum.pid: another copy is running as pid 2195. Another app is currently holding the yum lock; waiting for it to exit... The other application is: yum Memory : 23 M RSS (411 MB VSZ) Started: Thu Jan 8 14:19:07 2015 - 00:36 ago State : Sleeping, pid: 2195
As you see in the output, it clearly says an another app is currently holding the yum lock. That means yum is already running by another user. As you may know already, you can install only one application using yum at a time.
Let us find out which process and user holding the yum lock.
ps aux | grep yum
Sample output:
ps aux | grep yum root 2195 0.8 10.2 878764 64640 tty1 S+ 14:19 0:04 /usr/bin/python /bin/yum update root 2238 0.0 0.1 112640 972 pts/0 R+ 14:28 0:00 grep --color=auto yum
As see in the above output, an another process is already running. The PID 2195 is currently holding the yum lock.
Now, you have two choices. You can wait until the PID 2195 finish.
Or simply kill the PID using command:
kill -9 2195
Now, go ahead and start using the yum command.
Cheers!.