2017年9月26日 星期二

[研究] 關閉 PackageKit (CentOS 7.3 x64)

[研究] 關閉 PackageKit (CentOS 7.3 x64)

2017-03-19

有時候,在執行 yum 指令時候,會出現 yum 被 PackageKit 鎖住

Existing lock /var/run/yum.pid: another copy is running as pid 2692.
Another app is currently holding the yum lock; waiting for it to exit ...
  The other application is: PackageKit

而且用 ps  aux  | grep  PackageKit 找到 pid,用 kill -9  pid 刪除後,

再次執行,可能會發現又被 PackageKit 鎖住,再執行 ps  aux  | grep  PackageKit ,發現 PackageKit 以另一個 pid 又跑起來了,有時候要 kill 好幾次,才能讓 PackageKit 真正停止。
然後才能執行自己想要的 yum 指令。



刪除所有 PackageKit 程序

ps -ef | grep packagekit | awk '{print $2}' | xargs kill -9

PackageKit 相關服務如下

[root@localhost ~]# ls -1 /usr/lib/systemd/system  | grep packagekit
packagekit-offline-update.service
packagekit.service
[root@localhost ~]#

disable 參數:下次 reboot 系統重新啟動後,不會自動啟動 packagekit 服務

[root@localhost ~]# systemctl disable packagekit

ensable 參數:下次 reboot 系統重新啟動後,自動啟動 packagekit 服務


[root@localhost ~]# systemctl enable packagekit

stop 參數:立刻停止 packagekit 服務 ( reboot 後是否自動啟動要看 disable 或 enable)

[root@localhost ~]# systemctl stop packagekit

start 參數:立刻啟動 packagekit 服務 ( reboot 後是否自動啟動要看 disable 或 enable)


[root@localhost ~]# systemctl start packagekit

status 參數:查看packagekit服務狀態

[root@localhost ~]# systemctl status packagekit-offline-update.service
● packagekit-offline-update.service - Updates the operating system whilst offline
   Loaded: loaded (/usr/lib/systemd/system/packagekit-offline-update.service; static; vendor preset: enabled)
   Active: inactive (dead)
[root@localhost ~]#

結果 inactive (dead) 顯示該服務已被禁止啟動。

********************************************************************************
2017-10-18

CentOS 7.4 x64

有時候強行把 PackageKit 用 kill 刪除,會出問題

[root@localhost ~]# yum -y install iftop
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 2439.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (439 MB VSZ)
    Started: Tue Oct 17 18:54:09 2017 - 00:02 ago
    State  : Running, pid: 2439
^C

Exiting on user cancel.
[root@localhost ~]# ps aux | grep PackageKit
root       2439 24.0 22.8 1143668 228096 ?      RN   18:54   0:02 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none
root       2464  0.0  0.0 112660   972 pts/1    R+   18:54   0:00 grep --color=auto PackageKit
[root@localhost ~]# kill -9 2439
[root@localhost ~]# yum -y install iftop
error: rpmdb: BDB0113 Thread/process 2439/139840667322176 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@localhost ~]# yum -y install iftop
error: rpmdb: BDB0113 Thread/process 2439/139840667322176 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@localhost ~]# yum -y check-update
error: rpmdb: BDB0113 Thread/process 2439/139840667322176 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@localhost ~]#
(待續)

相關

PackageKit - 維基百科,自由的百科全書
https://zh.wikipedia.org/wiki/PackageKit

[研究] 解決 PackageKit 的 yum lock (CentOS 6.5 x64)
http://shaurong.blogspot.tw/2013/12/packagekit-yum-lock-centos-65-x64.html


沒有留言:

張貼留言