解決yum時出現 /var/run/yum.pid 已被鎖定,PID 為 3548 的另一個程式正在執行。
在CentOS 7.5下使用yum時出現系統處於鎖定狀態的解決方法。
問題如下:
[linuxidc@localhost Linux公社 www.linuxidc.com]$ sudo yum install vlc
[sudo] linuxidc 的密碼:
已載入外掛:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
/var/run/yum.pid 已被鎖定,PID 為 3548 的另一個程式正在執行。
Another app is currently holding the yum lock; waiting for it to exit...
另一個應用程式是:PackageKit
記憶體:309 M RSS (1.2 GB VSZ)
已啟動: Sat Feb 23 09:23:51 2019 - 11:18之前
狀態 :睡眠中,程序ID:3548
Another app is currently holding the yum lock; waiting for it to exit...
另一個應用程式是:PackageKit
記憶體:309 M RSS (1.2 GB VSZ)
已啟動: Sat Feb 23 09:23:51 2019 - 11:20之前
狀態 :睡眠中,程序ID:3548
^C
Exiting on user cancel.
原因:
這是因為yum處於鎖定狀態中
解決方法:
可以通過強制關掉yum程序來解決這個問題,直接在終端執行 rm -f /var/run/yum.pid 將該檔案刪除,然後再次執行yum即可。
[linuxidc@localhost Linux公社 www.linuxidc.com]$ sudo rm -f /var/run/yum.pid
如下圖,就不會再出現 /var/run/yum.pid 已被鎖定 的問題了。
第2個方法:
有說:
PackageKit是一個離線更新服務,基本沒啥用途,應該永久禁用。
centos7下,開啟: /etc/yum/pluginconf.d/langpacks.conf
將第一行:enable=1改為enable=0
重啟電腦
然後再執行sudo yum update 就不會被鎖定了。
Linux公社的RSS地址 : https://www.linuxidc.com/rssFeed.aspx
本文永久更新連結地址: https://www.linuxidc.com/Linux/2019-02/157044.htm