Quickly edit a deb package

In a recent encounter with a third party deb package, I ran into a dependency issue. The only way to come out was to edit the list of dependencies and try my luck.

Let’s download a sample deb package which is no longer supported in Ubuntu-14.04 (may be even earlier releases too). 

  1. mkdir /tmp/deb-exp && cd /tmp/deb-exp
  2. wget http://zevenos.com/files/lxproxy_0.1ubuntu3_all.deb
  3. A typical deb file contains usr, DEBIAN directory, usually in compressed form. Extract them as
    sudo dpkg-deb -R lxproxy_0.1ubuntu3_all.deb extracted-files/
  4. Edit the relevant file, in our case control file and repack the deb
    sudo dpkg-deb -b extracted-files/ lxproxy_0.1ubuntu3_1_1404_all.deb

That’s all, now install the deb package using gdebi and it should work.

Optionally, if you do not have sudo access you may get into ownership issues with extracted files, it is recommended to use ar and tar instead and edit files.