Fork me on GitHub
Suzf  Blog

Yum_Faq: unpacking of archive failed on file XXX: cpio: rename

今天对系统进行更新大更新了一百多个包,但唯独一个包安装失败。
错误信息如下: error: unpacking of archive failed on file /etc/inittab: cpio: renamecpio
错误 从字面上上来看应该是拷贝/替换文件错误 , 原因可能是权限控制

[10:31:12][[email protected] ~]#yum upgrade -y
Loaded plugins: fastestmirror
Setting up Upgrade Process
...

Running Transaction
Updating : initscripts-9.03.49-1.el6.centos.x86_64 1/2
Error unpacking rpm package initscripts-9.03.49-1.el6.centos.x86_64
error: unpacking of archive failed on file /etc/inittab: cpio: rename
Verifying : initscripts-9.03.49-1.el6.centos.x86_64 1/2
initscripts-9.03.46-1.el6.centos.1.x86_64 was supposed to be removed but is not!
Verifying : initscripts-9.03.46-1.el6.centos.1.x86_64 2/2

Failed:
initscripts.x86_64 0:9.03.46-1.el6.centos.1 initscripts.x86_64 0:9.03.49-1.el6.centos

Complete!

所以错误应该出现在 /etc/inittab 以至于更新文件无法更改
可能是不可改变的属性已经设置在这个文件之上,让我们先来查看一下。

[10:32:22][[email protected] ~]#lsattr /etc/inittab
----i---------- /etc/inittab

让我们删除这个属性
[10:32:55][[email protected] ~]#chattr -i /etc/inittab

让我们再来执行以下更新 看看问题是否解决
[10:33:07][[email protected] ~]#yum upgrade -y
Loaded plugins: fastestmirror
Setting up Upgrade Process
...

Downloading Packages:
initscripts-9.03.49-1.el6.centos.x86_64.rpm | 945 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : initscripts-9.03.49-1.el6.centos.x86_64 1/2
warning: /etc/sysctl.conf created as /etc/sysctl.conf.rpmnew
Cleanup : initscripts-9.03.46-1.el6.centos.1.x86_64 2/2
Verifying : initscripts-9.03.49-1.el6.centos.x86_64 1/2
Verifying : initscripts-9.03.46-1.el6.centos.1.x86_64 2/2

Updated:
initscripts.x86_64 0:9.03.49-1.el6.centos

Complete!

至此,问题解决。