Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Add more output. –  Ignacio Vazquez-Abrams Apr 10 '12 at 22:26

3 Answers 3

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.

share|improve this answer
    
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. –  djhaskin987 Apr 17 '12 at 17:59
up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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