Posts Tagged ‘extract deb file linux’

How to extract a deb package on Debian, Ubuntu, Mint Linux and other non debian based distributions

Friday, October 13th, 2017

how-to-extract-deb-packages-with-dpkg-and-ar-application-x-deb

How to extract a deb package? 


Have you ever had a debian .deb package which contains image files you need, but the dependencies doesn't allow you to install it on your Debian / Ubuntu / Mint Linux release?
I had just recently downloaded the ultimate-edition-themes latest release v 0.0.7 a large pack of GNOME Themes and wanted to install it on my Debian Stretch Linux but I faced problems because of dependencies when trying to install with dpkg.

That is why I took another appoarch and decided to only extract the necessery themes from the archive only with dpkg.

Here is how I have extracted ultimate-edition-themes-.0.0.7_all.deb ;

 

dpkg -x ultimate-edition-themes-.0.0.7_all.deb /tmp/ultimate-edition-themes

 

 

So how dpkg extracts the .deb file?

 


Debian .deb packages are a regular more in Wikipedia – Unix archive files (ar) .

The structure of a deb file consists of another 3 files (2 tar.gzs and one binary) as follows:

 

debian-binary: regular text file, contains the version of the deb package format
control.tar.gz: compressed file, contains file md5sums and control directory for the deb package
data.tar.gz: compressed file, contains all the files which will be installed


Basicly if you're on a Linux distribution that lacks dpkg you can easily extract .deb binary using GNU AR  command (used to create, modify extract Unix ar files and is the GNU / Linux equivallent of the UNIX ar command).

To extract on Fedora or RPM based Linux distributions as well as BSDs with AR:

First print file conetnt with:

ar p  ultimate-edition-themes-.0.0.7_all.deb

Then extract it with:

ar x ultimate-edition-themes-.0.0.7_all.deb

 


Later just extract with tar (untar), the 2 other archived files contained in the .deb (ar) archive:

 

 

tar -zxvvf control.tar.gz; tar -zxxvf data.tar.gz

 


Get everything you need from there in my case that's the usr/share/themes folder, then enjoy life 🙂