今天在虚拟机的Cent OS 6上安装redis时,遇到了一个错误,
Loaded plugins: fastestmirror, refresh-packagekit
Existing lock /var/run/yum.pid: another copy is running as pid 3004.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 26 M RSS (336 MB VSZ)
Started: Wed Mar 22 16:58:15 2017 - 01:47 ago
State : Sleeping, pid: 3004
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 36 M RSS (1.0 GB VSZ)
Started: Wed Mar 22 16:58:15 2017 - 01:49 ago
State : Sleeping, pid: 3004
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 34 M RSS (914 MB VSZ)
Started: Wed Mar 22 16:58:15 2017 - 01:51 ago
State : Sleeping, pid: 3004
找到了一个解决方案,很简单:
从上面的错误可以看出,是一个应用占用了yum锁,由于yum一次只能有一个应用使用,我们查看:
ps aux|grep yum
输出
[root@192 local]# ps aux|grep yum
root 3007 0.0 1.0 321904 20336 pts/1 T 17:00 0:00 /usr/bin/python /usr/bin/yum list
root 3029 0.0 1.0 321900 20336 pts/1 T 17:01 0:00 /usr/bin/python /usr/bin/yum install gcc-c++
root 3032 0.0 0.0 103312 884 pts/1 S+ 17:05 0:00 grep yum
可以看到相关应用的pid,使用
kill -9 pid
结束应用就行了。