3

When I try to run this command :

rpmbuild -bb SPECS/software.spec

I get an error when the WAR file (as in tomcat java web archive file) is being added to the rpm:

error: create archive failed on file /<filepath>/<filename>.war: cpio: Bad magic

This didn't use to happen. The only things that have changed since this worked was an upgrade. Further, no problems are happening like it on my CentOS 5 box. I compile and build the exact same code set on both machines, but CentOS 6 won't create an rpm.

How do I troubleshoot this? I have already googled it and received few (if any) useful links. This appears nowhere in the user guide for RPM as far as I can see, and Maximum RPM has no section on this.

1

6 Answers 6

5

Try checking your rpmbuild root directory. In my case, the disk was full and rpm build had no space to create the rpm. It failed with cpio bad magic error which is a misleading error.

NOTE: I tried the yum upgrade/update which did not help.

2

In all my searching, I decided that this was a bug in the rpmbuild version of CentOS 6. A quick 'yum update' solved the problem, as I suspected :) Hope this helps.

1

Can you try to run rpmbuild with -vv so that you see where exactly it choked? Likely the file in question is not found in the working directory for some reason, or otherwise corrupt. Magic number refers to the starting bytes of a unix file. Man magic for details.

1
  • I should have clarified that point. I know what magic is, and I checked the existence of the file first. It turns out the file is there and the output of 'file <file>' checks out. -vv doesn't shed any further light on the subject either, but I'm glad to be reminded of that route for future debugging. Good points. Apr 17, 2012 at 17:59
1

I had this issue because of a full /var/tmp, clearing a bit of space fixed it.

1

In my case, this is due to insufficient storage left in my machine. I have cleared enough space required for RPM and then everything worked fine.

0

I am using CpackRPM in cmake. While updating rpmbuild to last version was not helpful in my case, I understand this error due to some files in my packages they must run with root privileges.

So, I execute cpack or make package with sudo or root user.

In this case, you should care about your _tobdir and _buildroot variables to not affected by some configurations in rpmbuild.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .