1. 程式人生 > >yum 提示Existing lock /var/run/yum.pid waiting for

yum 提示Existing lock /var/run/yum.pid waiting for

lang oot 6.0 新的 head ati 數據 app extra

今天重置了下虛擬機,yum準備安裝gcc編譯器,出現如下錯誤

[root@localhost ~]# yum install -y gcc*
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 3593.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory : 109 M RSS (447 MB VSZ)
    Started: Thu Jul 26 18:25:02 2018 - 01:38 ago
    State  : Sleeping, pid: 3593
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory : 109 M RSS (447 MB VSZ)
    Started: Thu Jul 26 18:25:02 2018 - 01:40 ago
    State  : Sleeping, pid: 3593

但是我這是一個新的虛擬機,而且當前就連接了一個ssh用戶,也沒有使用yum,

顯示是yum在鎖定狀態中Existing lock /var/run/yum.pid,也知道pid是3593
通過kill幹掉他

[root@localhost ~]# kill -9 3593

然後再次檢查

[root@localhost ~]#** yum repolist **
BDB2053 Freeing read locks for locker 0x9b9: 3593/140359627216704
BDB2053 Freeing read locks for locker 0x9b7: 3593/140359627216704
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.tuna.tsinghua.edu.cn
repo id                                                               repo name                                                                status
base/7/x86_64                                                         CentOS-7 - Base                                                          9,911
extras/7/x86_64                                                       CentOS-7 - Extras                                                          363
updates/7/x86_64                                                      CentOS-7 - Updates                                                       1,004
repolist: 11,278

這樣yum可以正常使用


[root@localhost ~]# yum install -y gcc*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
…………
…………
Installed:
  gcc.x86_64 0:4.8.5-28.el7_5.1                 gcc-c++.x86_64 0:4.8.5-28.el7_5.1                   gcc-gfortran.x86_64 0:4.8.5-28.el7_5.1         
  gcc-gnat.x86_64 0:4.8.5-28.el7_5.1            gcc-go.x86_64 0:4.8.5-28.el7_5.1                    gcc-objc.x86_64 0:4.8.5-28.el7_5.1             
  gcc-objc++.x86_64 0:4.8.5-28.el7_5.1          gcc-plugin-devel.x86_64 0:4.8.5-28.el7_5.1         

Dependency Installed:
  cpp.x86_64 0:4.8.5-28.el7_5.1                   glibc-devel.x86_64 0:2.17-222.el7                glibc-headers.x86_64 0:2.17-222.el7              
  gmp-devel.x86_64 1:6.0.0-15.el7                 kernel-headers.x86_64 0:3.10.0-862.9.1.el7       libgfortran.x86_64 0:4.8.5-28.el7_5.1            
  libgnat.x86_64 0:4.8.5-28.el7_5.1               libgnat-devel.x86_64 0:4.8.5-28.el7_5.1          libgo.x86_64 0:4.8.5-28.el7_5.1                  
  libgo-devel.x86_64 0:4.8.5-28.el7_5.1           libmpc.x86_64 0:1.0.1-3.el7                      libmpc-devel.x86_64 0:1.0.1-3.el7                
  libobjc.x86_64 0:4.8.5-28.el7_5.1               libquadmath.x86_64 0:4.8.5-28.el7_5.1            libquadmath-devel.x86_64 0:4.8.5-28.el7_5.1      
  libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1       mpfr-devel.x86_64 0:3.1.1-4.el7                 

Dependency Updated:
  glibc.x86_64 0:2.17-222.el7           glibc-common.x86_64 0:2.17-222.el7   libgcc.x86_64 0:4.8.5-28.el7_5.1   libgomp.x86_64 0:4.8.5-28.el7_5.1  
  libstdc++.x86_64 0:4.8.5-28.el7_5.1  

Complete!

**總結:執行命令中遇到問題基本思路:
首先一定學會分析問題,必須有一個清晰的思路。
首先遇到問題不能害怕,
其次不建議直接去上網搜索,搜了好多,很可能還沒解決。
再此分享下我的解決思路,如下三步。希望對大家有幫助,當然我也是在不斷地學習中。
看提示(終端顯示的錯誤信息,建議執行方法)
查日誌(查看系統日誌 /var/log/目錄下的日誌文件,如果是相關服務,請查看服務的日誌文件,比如MySQL數據庫的日誌文件等)
上谷歌(通過網絡查看是否有相同或者相似的問題)**

yum 提示Existing lock /var/run/yum.pid waiting for