error: unpacking of archive failed on file /usr/bin/xxxx: cpio: open Failed

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.

Important:

In some cases though, the rpm file itself is corrupt and cannot be installed, so it is also recommended to try install the rpm on another server to see if it works. If it fails on another server too, you should download the package from a different website / mirror.

This entry was posted on Sunday, September 5th, 2010 and is filed under Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

3 Responses to “error: unpacking of archive failed on file /usr/bin/xxxx: cpio: open Failed”

  1. Dan

    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.

  2. Dan

    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.

  3. admin

    Thank you for your feedback. It will definitely help others.