I've gotten stuck on a problem. I'm packaging an existing project into an RPM. It builds fine but when I run

sudo yum localinstal --nogpgcheck <path to rpm>

I get the following error message:

Error: unpacking of archive failed on file <path to symlink>;5656d545: cpio: symlink

The RPM extracts the project into a directory and then updates an existing symlink latest to point to it by doing ln -sfn <app name and version>/ latest

Google yields next to nothing on this issue so I'm hoping that someone with more experience in these matters could offer a hand.


This happen when rpm package owns some directory or file while on the disk the file/directory is symlink. Or vice versa. This is known issue for long time.

You either have to manually remove the symlink before installing/upgrading the package. Or alter the package to not own that file.

| improve this answer | |
  • Related: I was getting error: unpacking of archive failed: cpio: lstat because I had a stray file on the filesystem where the RPM expected a directory to be. – Matt Chambers Aug 28 '17 at 20:55

I had a similar problem with CentOS 7.6 and Crystal.

Downloading packages:
crystal-0.27.2-1.x86_64.rpm                                                                                                              |  38 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : crystal-0.27.2-1.x86_64                                                                                                                      1/1
Error unpacking rpm package crystal-0.27.2-1.x86_64
error: unpacking of archive failed on file /usr/share/crystal/src/lib_c/amd64-unknown-openbsd: cpio: rename
  Verifying  : crystal-0.27.2-1.x86_64                                                                                                                      1/1

  crystal.x86_64 0:0.27.2-1


I ended up deleting the entire path in question: /usr/share/crystal/* which solved the problem.

| improve this answer | |

For me, this happened when I had a symlink pointing to a directory that didn't exist; for example i had a symlink from /opt/ going to /data/, but /data/ didn't exist because i had a spelling error when i mounted the drive (/daat/ if you're wondering).

Make sure your symlink is pointing to a valid location if it's supposed to be there.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.