site  contact  subhomenews

Busybox 'rpm2cpio' fails

June 16, 2011 — BarryK
I have run into a problem with expanding Mageia RPM packages. The Busybox 'rpm2cpio' applet cannot expand these files. A quick search returned just one hit:;topicseen

The problem seems to be that Mageia, and I presume Mandriva, is using XZ compression for the .rpm files. The Busybox 1.17.2 applets are supposed to support XZ. Hmmm, so I compiled the latest Busybox, 1.18.5, same problem.

Fortunately, the above link has a solution, to use the p7zip package. Downloading it right now.


7z fails too
Username: BarryK
Hmmm, I compiled 7z, that doesn't work either: [code]# 7za x -so zip-3.0-4.mga1.i586.rpm | cpio -i -d -m 7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_US,Utf16=on,HugeFiles=on,1 CPU) Processing archive: zip-3.0-4.mga1.i586.rpm Error: Can not open file as archive [/code]

rpm2cpio SL6
Username: MHHP
"Hello, when woofing up a SL6-pup, I just copied the busybox binary from SL6 to /bin. hth/ MHHP

Username: L18L
"To whom it may concern: Just donít use 7zr or 7za take 7z (package p7zip-full) instead. quoted from BrotDasBernd, comment in: HTH

7z uncompress
Username: pemasu
"sh-4.1# 7z x -so zip-3.0-4.mga1.i586.rpm | cpio -i -d -m 7-Zip 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30 p7zip Version 9.04 (locale=en_US,Utf16=on,HugeFiles=on,4 CPUs) Processing archive: zip-3.0-4.mga1.i586.rpm Extracting zip-3.0-4.mga1.i586.cpio Everything is Ok Size: 0 Compressed: 232268 1524 blocks

Username: Dougal
"Barry, why not use the actual xz util (from Lasse Colin's xz-utils)? The way I found for extracting xz-compressed rpm packages is: rpm2cpio $file | unxz - | cpio -i -d

Re unxz
Username: BarryK
"Dougal, No, that won't work, it is the first step, 'rpm2cpio' that complains of the "wrong magic" in the file. Besides, I'm not really sure that the Mandriva/Mageia .rpms are using xz. 01micko, Thanks, I only tried 7za and 7zr. I'll give the full version a go. Mageia is using RPM5. I downloaded version 5.3.5, but cannot compile it. I might try and get a precompiled binary of the rpm package.

Using 7z in Woof
Username: BarryK
"Yes, the full 7z works, thanks for the feedback on that. I have modified script '2createpackages' in Woof so that if Mageia RPMs are being used then it requires 'p7zip' (and executable 7z) to be installed. I'm running '2createpackages' right now. One thing, 7z is extremely slow in extracting from .rpm files. Incredibly slow.

RPM in Mageia
Username: Dougal
"Barry, this might explain the problem with Mageia RPM:

mageia rpms work on 2.14x
Username: ttuuxxx
"hi barry I downloaded and click on it in 2.14x and rox used /usr/local/bin/alienmanager to install it. Alienmanager in 2.14x was modified by the user clarf for 2.14x, here is a link to the used in 2.14x also Fileroller can extract 7zip packages with the older 7zip being installed. just tested it. If you have gconf installed than fileroller sources can be hacked to remove extra deps like GDU etc, but gconf is needed. Last time I check gconf/orbit/Fileroller was under 1MB combined. ttuuxxx

Username: 01micko
"I went through the process of compiling rpm-4.8.1 from Mageia source There is heap of patches in the archive but they all apply cleanly, I did it in one loop. I had to set CPPFLAGS to find nss/nspr. [i]export CPPFLAGS="-I/usr/include/seamonkey-2.1b3/nspr -I/usr/include/seamonkey-2.1b3"[/i](a Slackware SM package, but it had some dummy libs failing in 'make' so transferred real libs from another SM package, so mainly used it for the headers) I didn't have the 'file' headers installed (magic.h) so found that (this is in spup, so I need to fix that in my devx). I kept getting "nss3" errors using configure so I used That gets rid of all the 'nss3' references in configure too. Then got lua error, so I just ran [i]./ --with-lua=no[/i].. didn't set --prefix=/usr because I didn't want to override stuff but it should really be set if you want the dev stuff, but if you were to use it I guess all the execs could be ditched except rpm2cpio, but then again it's the libs that make up the size. I split it up with new2dir (main package is 2580k uncompressed). It works, probably faster than 7z. I grabbed a mageia abiword package to test and it extracted successfully with: [i] rpm2cpio abiword-2.8.6-2.mga1.i586.rpm| cpio -idm[/i] So it's doable.

Mageia vs Mandriva
Username: BarryK
"Dougal, Thanks for that link, that is a very interesting read. I made a bad assumption, I knew that Mandriva use RPM5, so I assumed Mageia does to -- so I downloaded the latest RPM5 and attempted to compile it -- and failed. As Mageia is still using RPM4, I am puzzled that Busybox rpm2cpio can't handle it. 01micko, Thanks for compiling mageia's RPM source. Ok, I'll give that a go, see if I can compile it in Wary.

Username: ttuuxxx
"Hi Barry did you try clarf's code used in alienmanager-214x.tar.gz I posted above for rpms, it installs them without 7zip being installed. The code is too long to post here, over 2000 words, so the tar.gz is above. ttuuxxx

Username: BarryK
"Bingo! ttuuxxx, you have solved it! Alienmanager by clarf does the job. However, alienmanager has modifications specific to Puppy 2.x. The original script is 'exploderpm' (also handles .debs): Great, this is going into Woof, as a permanent script in all builds. Dougal, you will find that script interesting, how it detects compression type, then uses 'unxz', 'gunzip' or 'bunzip2'.

Username: Dougal
"Interesting that the script was originally written by Amigo (from the forum)... then used by Lasse Colin. Anyway... using object-dump is something I don't see the point in -- I presume what the script does is just what the "file" command does.

Tags: woof