![python-augeas,CentOS7 中的 yum 更新错误](https://linux22.com/image/674665/python-augeas%EF%BC%8CCentOS7%20%E4%B8%AD%E7%9A%84%20yum%20%E6%9B%B4%E6%96%B0%E9%94%99%E8%AF%AF.png)
我运行时遇到以下错误: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:
迈克尔·汉普顿对我的目录的权限的判断是正确的:
$ 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
答案1
设置/usr/lib/python2.7/site-packages/
为具有 777 权限不是一个好的解决方案。我还怀疑这是修复方法,因为通过使用,sudo
您以超级用户身份运行,无论如何都应该对该目录具有权限(不包括更复杂的 ACL)。
如果以不同的方式安装了 python 模块,也可能会发生此错误。模块在 中吗pip list
?如果是,则sudo pip uninstall augeas
在安装之前运行yum
应该可以解决问题。
如果可以的话,您不想混合使用包管理器。
答案2
发生这种情况的原因是 yum 无法删除指定文件的旧副本/usr/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg-info
。
这可能是因为权限设置不正确,或者设置了不可变属性。
检查指定文件/目录及其所在目录的权限和属性,并修复所有问题。然后重试更新。
ls -ld /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
ls -ld /usr/lib/python2.7/site-packages
lsattr -d /usr/lib/python2.7/site-packages