Error unpacking of archive failed cpio bad magic

sudo rpm -ivh *.el6.rpm *.fc20.rpm error: unpacking of archive failed: cpio: Bad magic --nomd5 --nodigest it still rpm5.0.0 http://rpm5.org/files/rpm/rpm-5.0 makefile LIBS= -lz -lpopt -beecrypt sudo make make install succeed rpm -ivh .el5.rpm all right but centos5 /usr/local/bin/rpm -ivh .el6.rpm error: unpacking of archive failed: cpio: Bad magic ldd librpm* all be centos5 libc glibc glib too low level? yum install these not find why? centos 5 different code with 6 include rpm package? whoes is centos5 have a try and tell me whether you can -ivh el6.rpm? what print?

xzby

Posts: 1
Joined: 2013/11/21 20:10:59

rpm error: unpacking of archive failed: cpio: Bad magic

sudo rpm -ivh *.el6.rpm *.fc20.rpm
error: unpacking of archive failed: cpio: Bad magic
—nomd5 —nodigest it still
rpm5.0.0 http://rpm5.org/files/rpm/rpm-5.0
makefile LIBS= -lz -lpopt -beecrypt
sudo make make install succeed
rpm -ivh .el5.rpm all right
but centos5 /usr/local/bin/rpm -ivh .el6.rpm error: unpacking of archive failed: cpio: Bad magic
ldd librpm*
all be
centos5 libc glibc glib too low level?
yum install
these not find
why?
centos 5 different code with 6 include rpm package?
whoes is centos5 have a try and tell me whether you can -ivh el6.rpm?
what print?

Last edited by xzby on 2013/11/21 21:20:01, edited 1 time in total.


User avatar

avij

Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: rpm error: unpacking of archive failed: cpio: Bad magic

Post

by avij » 2013/11/21 20:43:47

You can’t install CentOS 6 or Fedora 20 RPMs on CentOS 5.

Which package are you trying to install? Perhaps there’s a package that will work with CentOS 5.


User avatar

TrevorH

Site Admin
Posts: 32527
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: rpm error: unpacking of archive failed: cpio: Bad magic

Post

by TrevorH » 2013/11/21 23:15:33

And installing a newer version of rpm is unlikely to help in the long run since it’s likely to just either confuse things or break them.

The correct way to deal with situations like this is to download the SRPM for fc20 and rebuild it on el5 using the el5 toolset and produce an RPM that’s designed to install on el5 in the first place. You may still run into trouble with things from fc20 needing newer packages and/or being built with systemd not sysv initscripts in mind…



Description


Casey Harkins



2015-05-24 16:07:31 UTC

Created attachment 1029223 [details]
rpm file which triggers error

Description of problem:

There appears to be a regression in rpm 4.12.0.1 which causes a "error: unpacking of archive failed: cpio: Bad magic" error with an rpm created by redline with a symlink. It is possible this is actually a bug in redline's construction of the rpm which is only triggered on rpm 4.12.0.1. The error is not triggered on rpm 4.8.0 on CentOS or 4.11.3 on Fedora 20.

Version-Release number of selected component (if applicable):

  rpm-4.12.0.1-6.fc21.x86_64

How reproducible:

  100% reproducible with attached rpm.

Steps to Reproduce:
  1. rpm -iv foo-1.0.0-1.noarch.rpm

Actual results: (Fedora 21 w/ rpm-4.12.0.1-6.fc21.x86_64)

  Preparing packages...
  foo-0:1.0.0-1.noarch
  error: unpacking of archive failed: cpio: Bad magic
  error: foo-0:1.0.0-1.noarch: install failed

Untracked files left in /opt/foo.


Expected results: (Fedora 20 w/ rpm-4.11.3-1.fc20.x86_64)

  Preparing packages...
  foo-0:1.0.0-1.noarch

Also tested successfully on CentOS 6 w/  rpm 4.8.0.

Additional info:

The rpm is attached. It was generated with a minimal gradle script using the nebula.os-package gradle plugin (build.gradle attached). It can be recreated by running 'gradle fooRpm' in a directory containing build.gradle.

Commenting out the 'link' line in build.gradle will create an rpm without the symlink. The resulting rpm can be successfully installed on Fedora 21, so the problem seems to be specific to the symlink.


Comment 3


Casey Harkins



2015-05-24 21:12:40 UTC

The relevant code in lib/cpio.c triggering the error:

    #define CPIO_NEWC_MAGIC "070701"
    #define CPIO_CRC_MAGIC  "070702"

    ...


    if (strncmp(CPIO_CRC_MAGIC, magic, sizeof(CPIO_CRC_MAGIC)-1) &&
        strncmp(CPIO_NEWC_MAGIC, magic, sizeof(CPIO_NEWC_MAGIC)-1)) {

            return RPMERR_BAD_MAGIC;
    }


When trying to install the attached rpm, magic is "/opt/f" at the point of failure. I don't know enough about the rpm file format (yet) to figure out if the problem is with the rpm itself but somehow earlier rpm versions are more forgiving, or if it is an obscure bug here in rpm 4.12.0.1.

I suspect the behavior changed in rpm with this commit, but haven't confirmed:

https://github.com/rpm-software-management/rpm/commit/000dc5f499b34de55026c3ba33dc83de669d5b96


Comment 4


Casey Harkins



2015-05-25 03:17:17 UTC

The first two entries in the cpio are getting handled correctly (directory /opt/foo and regular file /opt/foo/build.gradle). The third entry is the symlink. The cpio header is getting read correctly by rpm, including reading the file size as 21 bytes. However, the file size from the cpio header is not being used in lib/rpmfi.c iterReadArchiveNext():

   } else if (S_ISLNK(mode)) {
        /* Skip over symlink target data in payload */
        rpm_loff_t lsize = rpmfilesFSize(fi->files, fx);

It appears to be getting the size from elsewhere in the rpm. In this case it is returning a size of 0 for this symlink instead of 21. Is there an easy way to dump the full file info from the rpm?

Obviously the zero size is the problem. rpm does not read or skip the symlink data before trying to read the header for the next cpio entry (the TRAILER!!!). Instead of getting the magic number, its getting the first 6 bytes of the symlink data ("/opt/f").


Comment 5


Ľuboš Kardoš



2015-05-25 14:11:37 UTC

Your rpm package wasn't created correctly. The size of file /opt/foo/linked.gradle is not set properly in rpm header:

$ rpm -qp --qf "[%{filenames} %{filesizes}n]" /tmp/foo-1.0.0-1.noarch.rpm
/opt/foo 4096
/opt/foo/build.gradle 349
/opt/foo/linked.gradle 0

How does redline construct rpm? Does it use rpmbuild somehow? 

To dump whole rpm header you can use "rpm -q --xml -p /tmp/foo-1.0.0-1.noarch.rpm".


Comment 6


Casey Harkins



2015-05-25 17:41:15 UTC

I had just discovered that the filesize for the symlink was 0 in the rpm header entry, though I walked my way through the rpm with a hex editor. I knew there had to be an easier way to dump out the header (or query the header fields). Thanks for the help there!

redline is a pure java library, so it does not rely upon rpmbuild for constructing the rpm. This is obviously a bug in redline not setting the size properly for the symlink (I'll file a bug with them and possible a patch).

It is interesting that older versions of rpm work fine. I suspect that they were relying upon the filesize from the cpio header rather than the rpm header.

Thanks again for your help! This can be closed as not a bug. (I'm not clearing the needinfo if that helps).

From the investigations done to adapt the acceptance_test feature branch to the new package format, see #5341 for details. I discovered the current master rpm package does not install in fedora-22, see:

[vagrant@localhost ~]$ sudo yum install -y /logstash-build/logstash-5.0.0.dev.rpm 
Yum command has been deprecated, redirecting to '/usr/bin/dnf install -y /logstash-build/logstash-5.0.0.dev.rpm'.
See 'man dnf' and 'man yum2dnf' for more information.
To transfer transaction metadata from yum to DNF, run:
'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate'

Failed to set locale, defaulting to C
Last metadata expiration check performed 0:12:52 ago on Fri May 27 15:45:43 2016.
Dependencies resolved.
=========================================================================================================================================================
 Package                            Arch                            Version                                  Repository                             Size
=========================================================================================================================================================
Installing:
 logrotate                          x86_64                          3.8.8-1.fc22                             fedora                                 70 k
 logstash                           noarch                          1:5.0.0~dev-1                            @commandline                           96 M

Transaction Summary
=========================================================================================================================================================
Install  2 Packages

Total size: 96 M
Total download size: 70 k
Installed size: 182 M
Downloading Packages:
logrotate-3.8.8-1.fc22.x86_64.rpm                                                                                        237 kB/s |  70 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                     36 kB/s |  70 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Installing  : logrotate-3.8.8-1.fc22.x86_64                                                                                                        1/2 
  Installing  : logstash-1:5.0.0~dev-1.noarch                                                                                                        2/2 
Error unpacking rpm package logstash-1:5.0.0~dev-1.noarch
Error unpacking rpm package logstash-1:5.0.0~dev-1.noarch
error: unpacking of archive failed: cpio: Bad magic
logstash-1:5.0.0~dev-1.noarch was supposed to be installed but is not!
  Verifying   : logstash-1:5.0.0~dev-1.noarch                                                                                                        1/2 
  Verifying   : logrotate-3.8.8-1.fc22.x86_64                                                                                                        2/2 

Installed:
  logrotate.x86_64 3.8.8-1.fc22                                                                                                                          

Failed:
  logstash.noarch 1:5.0.0~dev-1                                                                                                                          

Complete!
[vagrant@localhost ~]$ 

for details.

Are you stuck with the RPM Error Unpacking of Archive Failed on File? We can help you.

Usually, the error message occurs when the system fails to install the RPM command.

At Bobcares, we often get requests regarding RPM errors, as a part of our Server Management Services.

Today, let’s see how our Support Engineers fix the RPM error for our customers.

Explore more about RPM

RPM is the Red Hat Package Manager. To install packages under Linux systems we use RPM. The RPM package contains an arbitrary set of files like binary RPMs and source RPMs.

The source RPMs build the binary package and the binary RPMs is the compiled version of some software.

To install, upgrade or remove the programs on the Linux system, we use rpm command.

How to fix RPM Error Unpacking of Archive Failed on File?

Recently, one of our customers approached us with the same error. Now, let’s discuss how our Support Engineers fix the error for our customers.

Read Failed Error

The cpio is an archive utility and the cpio: read failed error means that the installing package is corrupt.

RPM Error Unpacking of Archive Failed on File

To fix the error our Support Engineers follow the below steps.

1. Initially, we download the package from a reliable source.

2. Then we compare the size and md5sum of the RPM copy on the system.

ls -l [rpm]
md5sum [rpm]

If there is a difference in the checksum then we do a fresh download of the RPM package from the reliable source.

Here we use the wget command to download the package file directly to the server.

Open Failed Error

Another customer approached us saying that he is getting an open fail error while installing the package using rpm command.

error: unpacking of archive failed on file /xxx/xxx/xxx: cpio: open Failed:

This error occurs if an attribute is set on the directory.

So, we use the lsattr command to check if an attribute is set on the directory.

[root@server ~]# lsattr file
----i----------- file

The i indicates that the attribute is set for the file. So that we cannot alter, rename or delete the file. To fix the error, we remove the immutable bit by using the ‘chattr’ command.

After removing the attribute bit we successfully installed the RPM package. But in some cases removing the attribute bit not fixes the error.

The reason is that the RPM file is corrupt. In such cases, we download the package again to fix the unpacking of archive error.

[Need assistance to fix RPM error? – We’ll help you.]

Conclusion

In short, today we discussed in detail on RPM Error Unpacking of Archive Failed on File and saw how our Support Engineers find the fix for this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Модератор: Модераторы разделов

AgentSS

Сообщения: 71

delta.rpm

Есть много *.delta.rpm для openSUSE 11. Как можно их установить если нет установочного диска но такие пакеты уже стоят (applydeltarpm как я понял требует наличия оригинального файла к которому применяется delta.rpm).

Аватара пользователя

k0da

Бывший модератор
Сообщения: 6043
Статус: SuSE QA Engineer
ОС: Factory
Контактная информация:

Re: delta.rpm

Сообщение

k0da » 11.09.2008 21:29

AgentSS
Пользуйе менеджер пакетов. Он сам по возможности будет использовать delta

Fury in my eyes, sword on my side
Afro on my head, I’m a black Samurai
Number One, I bring my whole nation alive
Escape death, to become immortalized

AgentSS

Сообщения: 71

Re: delta.rpm

Сообщение

AgentSS » 11.09.2008 21:52

Уже пробовал создавать репозитарий createrepo но они не ставятся:
Subprocess failed. Error: RPM failed: error: unpacking of archive failed: cpio: Bad magic

error: unpacking of archive failed: cpio: Bad magic

2008-09-12 02:58:12 zypper-0.11.10-0.1_0.2.i586.delta.rpm install failed
rpm output:
error: unpacking of archive failed: cpio: Bad magic

Аватара пользователя

k0da

Бывший модератор
Сообщения: 6043
Статус: SuSE QA Engineer
ОС: Factory
Контактная информация:

Re: delta.rpm

Сообщение

k0da » 11.09.2008 22:05

AgentSS
А зачем вы их качали если диска нет?

Fury in my eyes, sword on my side
Afro on my head, I’m a black Samurai
Number One, I bring my whole nation alive
Escape death, to become immortalized

AgentSS

Сообщения: 71

Re: delta.rpm

Сообщение

AgentSS » 11.09.2008 22:22

Это сейчас его нет, а раньше был и надеюсь скоро опять появиться.
И взяты они были из /var/cashe/zypp/ на обновленной системе.

Аватара пользователя

DobeR

Сообщения: 197
Статус: …….
ОС: Debian/CentOS

Re: delta.rpm

Сообщение

DobeR » 12.09.2008 11:23

Как сказал товарищ Кода — используйте менеджер пакета.
А так ждите дисочек или же проверьте репозитории.

«Тот, у кого хватит храбрости и терпения всю жизнь вглядываться во мрак, первым увидит проблеск света»

Аватара пользователя

Malcolm

Сообщения: 860
Статус: Изменник
ОС: Archlinux on IBM Z60m
Контактная информация:

Re: delta.rpm

Сообщение

Malcolm » 18.09.2008 19:01

Можно я немного тут попаразитирую?:) Не хочется заводить новую тему из-за пары вопросов.

Искал по форуму. Был на офсайте opensuse. Был на IRC-канале.
На некоторые вопросы не нашёл ответа.

Дельты делаются для каждой версии? А если я например пропустил одну версию? он будет качать две дельты?
Ну и из вышеизложенного следует => например я вот щас поставлю 11-ую сусе. Она вышла 19 июня, что оно будет качать при обновлении? Несколько десятков дельт? или новый пакет? Лично я несколько не понимаю:)

Заранее благодарен за ответ:)

Win7 on X200s || Android 2.3 on Galaxy Tab
Блог

Понравилась статья? Поделить с друзьями:
  • Error unmounting dev sda1 target is busy udisks error quark 14
  • Error unmounting dev nvme0n1p3
  • Error unmarshalling return nested exception is
  • Error unmarshaling return header nested exception is
  • Error unmarshaling json