I need to edit deb files sometime – usually I need to change the dependencies, like a few days ago, when I wanted to install python-pyopencl on a Debian unstable, but without the Nvidia dependencies. After some ducking (people who use Google are “googling”, I used Duck Duck Go so I suppose I “ducked”) I found a simple solution:
The .deb files have embedded inside them a “control” file. It is basically a text file which describes version, dependencies, conflict, suggests and so on. If someone wants to remove a dependency or a conflict, he needs to unpack the deb file (it’s a normal archive, actually), edit the control file and then repack the .deb file.
This is not really that complicated (you need to run 3 commands), but I found out a very useful script on the Ubuntu Forums. I modified it to use the $EDITOR environment variable, if it exists, and I changed his name to debcontroledit.
Download here my version of debcontroledit.
It’s really easy to use:
$ debcontroledit package.deb
The editor specified in $EDITOR will be started (or nano if $EDITOR is not defined) with the control file open. You can make any changes you need (changing dependencies, conflicts…) and if you save the file, the script will create a file called “package.modified.deb”, which you can install instead of your original deb file.
I hope it will be useful for you too – it saved me a lot of package management problems.
Comments? You know what to do with the box below!
Image credit: Đurađ Radojičić.
Related posts:






