Python

CentOS7中的python-augeas,yum更新錯誤

  • March 21, 2018

我在執行時遇到以下錯誤:sudo yum update

Downloading packages:
No Presto metadata available for base
python-augeas-0.5.0-2.el7.noarch.rpm                       |  25 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Updating   : python-augeas-0.5.0-2.el7.noarch                             1/2 
Error unpacking rpm package python-augeas-0.5.0-2.el7.noarch
error: unpacking of archive failed on file /usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info: cpio: rename
 Verifying  : python-augeas-0.5.0-2.el7.noarch                             1/2 
python-augeas-0.4.1-5.el7.noarch was supposed to be removed but is not!
 Verifying  : python-augeas-0.4.1-5.el7.noarch                             2/2 

Failed:
 python-augeas.noarch 0:0.4.1-5.el7     python-augeas.noarch 0:0.5.0-2.el7    

Complete!

我看到更新需要刪除一個文件。我的計劃是找到它並刪除,然後再次嘗試更新。但是,find -iname "python-augeas-0.4.1-5.el7.noarch"它不會為我返回任何東西,所以我懷疑刪除該文件是要走的路。

誠然,當涉及到這樣的事情時,我不是系統管理員,甚至不是很能幹。任何幫助表示讚賞。謝謝。


編輯1:

正如邁克爾漢普頓所建議的,這裡是權限和屬性:

$ ls -ld /usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info
drwxr-xr-x. 2 root root 4096 Jun 29  2015 /usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info


$ lsattr -d /usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info
---------------- /usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info

編輯2:

我用sudo yum remove python-augeas. 然後我重新安裝了以下錯誤:

$ sudo yum install python-augeas
Loaded plugins: fastestmirror, langpacks, remove-with-leaves
Loading mirror speeds from cached hostfile
* base: mirrors.rit.edu
* epel: mirror.steadfast.net
* extras: centos.chi.host-engine.com
* nux-dextop: mirror.li.nux.ro
* updates: mirrors.rit.edu
Resolving Dependencies
--> Running transaction check
---> Package python-augeas.noarch 0:0.5.0-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
Package                                 Arch                             Version                                Repository                      Size
======================================================================================================================================================
Installing:
python-augeas                           noarch                           0.5.0-2.el7                            base                            25 k

Transaction Summary
======================================================================================================================================================
Install  1 Package

Total download size: 25 k
Installed size: 71 k
Is this ok [y/d/N]: y
Downloading packages:
python-augeas-0.5.0-2.el7.noarch.rpm                                                                                           |  25 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : python-augeas-0.5.0-2.el7.noarch                                                                                                   1/1 
Error unpacking rpm package python-augeas-0.5.0-2.el7.noarch
error: unpacking of archive failed on file /usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info: cpio: rename
 Verifying  : python-augeas-0.5.0-2.el7.noarch                                                                                                   1/1 

Failed:
 python-augeas.noarch 0:0.5.0-2.el7                                                                                                                  

Complete!

編輯 3:

Michael Hampton 關於我的目錄的權限是正確的:

$ ls -ld /usr/lib/python2.7/site-packages/
drwxr-xr-x. 161 root root 12288 Jan 14 12:47 /usr/lib/python2.7/site-packages/

解決方案:

sudo chmod 777 /usr/lib/python2.7/site-packages/
sudo yum install -y python-augeas

設置/usr/lib/python2.7/site-packages/perms 777 不是一個好的解決方案。我也懷疑這是修復,因為通過使用sudo您以超級使用者身份執行並且無論如何都應該對該目錄具有權限(不包括更複雜的 ACL)。

如果 python 模組以不同的方式安裝,也會發生此錯誤。模組在pip list嗎?如果是,那麼sudo pip uninstall augeas在安裝它之前執行yum應該可以解決問題。

如果你能提供幫助,你不想混合包管理器。

引用自:https://serverfault.com/questions/748514