The 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 the ‘lsattr’ command to check if an attribute is set on the directory:
# lsattr /usr | grep bin ----i-----I-- /usr/bin
If the file/directory have an immutable bit (lowercase ‘i’) set as shown in the above output, it indicates that the permissions to write in the file/directory has been denied.
To remove the immutable bit, use the ‘chattr’ command:
# chattr -i /usr/bin
Once done, you can successfully install the rpm.
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.