How to fix "existing lock /var/run/yum.pid" error

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to fix "existing lock /var/run/yum.pid" another copy is running as pid error.

If you encountered this error when trying to update your machine, it means that yum was being used by another process at that time, and the update couldn't be completed.

The error "existing /var/run/yum.pid another copy is running as pid" doesn't only happen when you are trying to update your system, it happens whenever using yum package manager, whether you are trying to update, install or do something else.

To fix this error, simply follow the steps below.

How did this error happen

In our case this error happened, after installing a fresh copy of CentOS on our machine. So basically we were going to update our machine by using terminal and yum package manager.

So we ran

sudo yum update

Output

The output of the command above

Fix this error

The error "existing lock /var/run/yum.pid" another copy is running as pid, can be fixed easily by killing the process that is using yum.

The output of this error also shows the process ID that is causing this issue, so you can easily kill the process using its PID.

As you can see in the output above, the process in our case that was not letting us to use yum, was process 2641.

The solution to this error, is by simply killing the process 2641.

So we proceeded to kill the process 2641 by using the kill command.

sudo kill -9 2641

The process ID would be different for your case, so make sure to replace 2641 with your process ID.

And after terminating the 2641 process, we were able to use yum and update our machine.

sudo yum update

Conclusion

In this tutorial, you learned how to fix the error "existing lock /var/run/yum.pid" another copy is running as pid, by killing the process that was using yum at that time.