How to unlock yum update while it is running: Solution to “Another app is currently holding the yum lock” error

If you are forced to exit while running the yum update command, you may receive the error message “Another app is currently holding the yum lock; waiting for it to exit…” the next time you run the command. This is because the yum remains locked. This occurs because yum remains locked and cannot be accessed by other processes. Specific steps to resolve this issue are described below.

Cause of Error

This error is caused by a locked file or process left behind when yum terminates abnormally during execution. Since the lock is waiting to be released, it cannot be operated normally. This causes yum operation to stop and package updates and installations cannot be performed.

Solution

To resolve this situation, follow the steps below to resolve the issue.

1. Check the relevant process and force it to terminate.

First, you need to check the corresponding process and kill it in order to unlock yum.

ps aux | grep yum

Check the yum-related processes running with the above command. The process ID (PID) will be displayed, so kill the corresponding PID.

kill -9 [process ID].

kill -9 is a command to kill a process. Specify the ID of the confirmed yum process as the process ID.

2. Deleting yum lock files

Even if you kill the process, the lock may not be released. In that case, delete the PID file used by yum to release the lock.

sudo rm -f /var/run/yum.pid

This command will delete the yum lock file and release the lock status. This file is temporarily generated during yum operation, so deleting it will not affect the system.

3. Execute yum update again.

After terminating the process and deleting the lock file according to the above procedure, execute yum update again.

sudo yum update

If the lock is successfully removed, yum update will start without any problem and the package will be updated.

Troubleshooting Notes

  • Risk of forced termination: The kill -9 command will force a process to exit, so use it with caution. The process being killed may affect other critical processes, so check the processes and kill the appropriate ones.
  • Consider also rebooting: If you are unable to manually terminate a process or if it is not unlocked, consider rebooting the system. A reboot will reset all processes and unlock yum.
  • Check for other yum processes: It is important to closely monitor the processes on your system, as other automatic updates or cron jobs may be using yum.

Conclusion

The locking issue during yum update can be resolved by killing the process and removing the lock file. By understanding how to deal with this issue, you can make yum operation smoother and server management more efficient. Take appropriate action based on these procedures to maintain system stability.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top