error: unpacking of archive failed on file /usr/bin/xxxx: cpio: open Failed
Posted by Category: Linux AdministrationThe error message “unpacking of archive failed on file /usr/bin/xxxx: cpio: open Failed” indicates that the system failed to install the rpm since it cannot unpack the package under the /usr/bin directory.
For example, you may see the error message as stated below while installing a ‘nano’ package using yum
Error unpacking rpm package nano-1.x.x.i386
error: unpacking of archive failed on file /usr/bin/nano;4c70f874: cpio: open Failed:
This indicates that the file /usr/bin/nano cannot be created under the /usr/bin directory which mostly happens if an attribute is set on the directory.
Use ‘lsattr’ command to check the attributes set on the directory:
root@server [~]# lsattr /usr | grep bin
If the output is something like the following, it states that the immutable bit (lowercase ‘i’) is set to the “/usr/bin” directory thus denying to write under that directory.
----i-----I-- /usr/bin
Use ‘chattr’ command to remove the attributes from the directory:
root@server [~]# chattr -i /usr/bin
Once done, you can successfully install the rpm.
Tags: check the attributes of a directory, cpio: open Failed error while using yum, cpio: open Failed message while installing a rpm, Error unpacking rpm package, how to check attributes of "bin" directory?, remove the attributes from bin directory, unpacking of archive failed on file

June 30th, 2011 at 2:08 am
I got the same error, but I ran ‘lsattr -d /usr/bin’ and the ‘i’ flag was not set. Any idea what else could be wrong?
I am able to rename a file in /usr/bin using mv, but writing to any file using ‘echo bla >/usr/bin/bla’ gives me a “Invalid argument” error.
June 30th, 2011 at 2:51 am
I found my problem: SELinux was failing because I had mounted /var/log from a ramdisk after I installed an SSD, and so the /var/log/setroubleshoot directory was missing.
I removed the mount for /var/log from /etc/fstab, since I figured I might want to look at the logs after reboot anyway, and now everything is working fine.
July 6th, 2011 at 9:41 am
Thank you for your feedback. It will definitely help others.