31

I often encounter the "Another app is currently holding the yum lock; waiting for it to exit..." message when trying to install an app and I have to kill yum manually. How can I avoid that? Is there any simple method to unlock yum?

It seems that only one instance of yum can be running. Is it the same with other package mangers (apt-get, pacman)?

  • In my case, I was connected to a server via VPN. Once I ran sudo yum -y update, all packages were getting updated, along with open-VPN. Once open-VPN package got updated, I was disconnected from the VPN. I log back in, try the yum update again and it says the same thing. – arun Sep 16 '17 at 13:56
24

I think it is caused by PackageKit. You have to check for PackageKit and disable it (I assume it is CentOS 7 with systemctl, otherwise you can use service and chkconfig) (as mentioned in comments, the service name is packagekit not packagekitd):

systemctl stop packagekit
systemctl disable packagekit

Another approach (On CentOS/RHEL 6, Fedora 19 or earlier) is to open /etc/yum/pluginconf.d/refresh-packagekit.conf with a text editor, and change enabled=1 to enabled=0.

Or you can completely remove it:

yum remove PackageKit
  • 3
    It is called packagekit.service on my Centos 7 – Vadim Kotov May 25 '17 at 9:21
  • In my case, I simply ran systemctl stop packagekit and then the yum lock was freed. – T-Heron Oct 29 '17 at 11:52
9

do the following to solve the problem:

cd /var/run
rm -f yum.pid

you could also update your yum afterward

yum -y update
  • 1
    This is fighting symptoms and not fixing the real cause. – Axel Beckert Jun 20 '18 at 9:34
4

You can unlock yum by following two simple steps,

1) Run ps aux | grep yum to see which process is locking yum. 2) kill <process_id> to kill the process.

Again run ps aux | grep yum to see if the process is killed or not. Yum will be unlocked after killing the process.

  • 3
    this "works" but is probably bad practice – Dave Cousineau Oct 26 '16 at 16:38
  • 1
    This works in select circumstances. I have encountered a situation where systemd restarts the packagekit process before I can start my own yum command. And yes, also it is probably bad practice to kill the PID instead of gracefully telling packagekit to not run. – 0xSheepdog Aug 8 '17 at 21:34
1

In my case, I was connected to a server via VPN (open VPN). Once I ran sudo yum -y update, all packages were getting updated, along with open-VPN. Once open-VPN package got updated, I was disconnected from the VPN. I logged back in, tried the yum update again and it said another process is holding the yum lock.

I checked with ps ax | grep yum and the old process was still running. I waited for 5 min for it to "finish", but the process just kept running. Then I thought I could "pull the trigger" with kill, so I ran

kill <PID of the yum update process>

That didn't kill the process. Tried that a few more times, and still no success.

Finally I had to really pull the plug on it, by running:

kill -9 <PID of the yum update process>

Tried yum update again, but same issue. I then ran:

rm -f /var/run/yum.pid

and then tried update and got this output:

Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: mirror.sigmanet.com
 * epel: mirror.sjc02.svwh.net
 * extras: mirrors.vpsie.com
 * updates: mirror.pac-12.org
No Packages marked for Update

Believe everything is good, but I didn't like pulling the plug on so many things!

0

systemctl disable packagekit is not enough. packagekit will be running upon reboot. Use the mask command instead of the disable command.

[root@localhost yum.repos.d]# systemctl mask packagekit
Created symlink from /etc/systemd/system/packagekit.service to /dev/null.

Then upon reboot you will see ...

[sri@localhost ~]$ systemctl status packagekit
● packagekit.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.