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

Posted by admin     Category: Linux Administration

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 ‘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: , , , , , ,

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

  1. Dan Says:

    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 Says:

    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 Says:

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

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image