Skip to content

.deb files are ar archives, but ...

Just to express my frustration of the day a bit. I want the left column to be higher than the right one here. ;-)

From time to time you hear people boasting that they can use standard tools to handle .deb archives. "ar x blablah_0.123-4_z80.deb" and you get two standard tar.gz files to play with. That's indeed convenient, more convenient than rpm2cpio.

However, just try, on a Linux system, to convert those two tarballs (and the debian-binary file, of course) back to a .deb. "ar cr blablah_0.123-4.1_z80.deb debian-binary control.tar.gz data.tar.gz" will do, right? Try to install it using dpkg... Yes, it works! But then, try to put it in your apt repository!

QUOTE:
pool/main:
E: This is not a valid DEB archive, missing 'debian-binary' member
E: Errors apply to file 'iso/pool/main/b/base-installer/base-installer_1.42ubuntu12_amd64.udeb'


Turns out that there are multiple ar formats and that Debian uses a very simple format and doesn't (fully) support the ar files produced by GNU ar. It's quite confusing that dpkg does support these files while apt does not. Some consistency (or at least packaging a version of ar that is compatible with apt) would be nice, guys.

Anyway, to not be too negative in this post: debian-installer is pretty cool, once you understand the internals a little bit. I just spent a couple of days now on customizing an USB stick installation image, and I think I understand the system at least for a few percents by now. ;-) Have to find the limits of what can be done with preseeding files now. Having fun!

... What ... if anyone reads this? Dunno. :-P

(See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=161593)

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

isaac on :

no longer works.... cant seem to recreate a deb file using ar anymore (can still extract one) aw well....

Wilmer on :

Yes, that's exactly what I meant. ;-)

You mean that it used to work BTW?

bernie on :

Yes it is fun to read to those who are interested.

Justin on :

Any chance of updating this to include how one WOULD take those nasty little files and glue 'em back together w/o using ar so that the repository doesn't puke?

Wilmer on :

IIRC there is no real fix, the only thing you can do is use apt-ftparchive (or something like that) instead of the standard dpkg tool. I don't remember the details, it's been a while since I worked on this. Good luck! And if you figure this out, can you post it here as a comment? It seems that people end up on this page every now and then when they have this problem.

Justin on :

Not quite what I was looking for but I did manage this:

ar -x original.deb
mkdir -p tmp/DEBIAN
cd tmp
tar -xzvpf ../data.tar.gz
cd DEBIAN
tar -xzvpf ../../control.tar.gz
cp ../../debian-binary ./
# Make some tweak to preinst/postinst/etc...
cd ../../
dpkg-deb -b tmp new.deb
# new.deb should not cause the same complaints

Ikem on :

This will create a valid debian package:

CODE:
ar r package.deb debian-binary control.tar.gz data.tar.gz

The order is important!

Wilmer on :

Even with GNU ar?

Have to keep in mind that this post is nearly six years old, so things might have changed.

But thanks for the hint, definitely!

Ikem on :

I was working on that yesterday.

I'm running Debian Wheezy.

And I checked it, it's gnu ar.

So this info is up-to-date. :)

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.


BBCode format allowed
Form options