Gionelle Tribiana
Gionelle Tribiana

Reputation: 3

error: unpacking of archive failed: cpio: Bad magic when installing an rpm

I packaged an rpm using

  make package

command, and copied the resulting rpm to another machine which has a company specific OS. Now when I try to install the rpm using

  rpm --nodeps -i filename.rpm

I get the error the same as the one in the title.

So I ran

  rpm -qa | grep rpm

on the machine used to build the rpm package, and got this:

  rpm-4.8.0-37.el6.x86_64
  rpm-devel-4.8.0-37.el6.x86_64
  rpm-python-4.8.0-37.el6.x86_64
  rpm-libs-4.8.0-37.el6.x86_64
  rpm-build-4.8.0-37.el6.x86_64
  redhat-rpm-config-9.0.3-51.el6.noarch

After a bit of investigation, I tried removing the redhat-rpm-config package and bam, rpm installation worked on the other machine. Now, this is a solution and all but I don't think I can just uninstall this package for every machine that we're going to use in creating the rpm. Is there any other way to ignore this redhat-rpm-config-9.0.3-51.el6.noarch when creating an rpm package using cmake?

Upvotes: 0

Views: 11648

Answers (3)

To solve "error: unpacking of archive failed: cpio: Bad magic" issue at RPM package installation on your machine:

1/ List rpm pkgs which are installed on the server machine (the machine on which the rpm pkg is generated): $ rpm -qa | grep rpm …. …. 2/ If pkg redhat-rpm-config-9.0.3-51.el6.noarch is present in the given list, desinstall it:

$ rpm -e redhat-rpm-config-9.0.3-51.el6.noarch

3/ Generate now the pkg and tranfer it on your dev machine. Pkg installation should work.

 Philippe.

Upvotes: 0

msuchy
msuchy

Reputation: 5427

You very likely made binary RPM using rpmbuild on different OS than was the target OS. You should use "mock" for building the package.

dnf install mock
mock -r epel-6-x86_64 yourpackage.src.rpm

Upvotes: 0

Florian Weimer
Florian Weimer

Reputation: 33719

What is the RPM version of the system you are installing on? Are its sources publicly available somewhere?

There could be various compatibility issues if you build binary RPMs using a newer RPM/distribution. In general, we build binary RPMs using the RPM and redhat-rpm-config versions in the buildroot (which is created by mock) itself, which matches the target RPM version, even if the build host has a newer RPM version.

If this is not an option for you, I would look at specific RPM features controlled by redhat-rpm-config. The one that sticks out to me immediately is payload compression:

# Use XZ compression for binary payloads
%_binary_payload w2.xzdio

Other changes include support for larger files, but this does not seem to be the issue here because it would not change by uninstalling the redhat-rpm-config package.

Upvotes: 2

Related Questions