1

I am new to Ubuntu and would like to know if there's a way to modify or edit the details of a deb package. For example, I'm running the command: sudo dpkg -I myPackage_amd64.deb and get several categories, such as Version, architecture, section, etc..

How can I remove or change the values of one or more of these categories?

Thanks very much.

5

The usual way to do this would be from a source tree. You would get a source tree by either downloading it or executing a command such as apt-get source some-package.

Once the source tree is downloaded, you would follow these steps:

  1. cd some-package*/debian
  2. nano control
  3. The control file holds information for the source tree and packages generated from the source. For the source tree, there are several fields including "Build-Depends", "Maintainer", "Section". For the package, there are fields such as "Architecture", "Depends", "Suggests", and "Description".
  4. nano changelog
  5. This is the version file that contains the changelog for this package. Simply modify the version number, or add your own section above it with your own version number.
  6. debuild -us -uc will re-build the package with the updated information

However, it's theoretically possible to do this by simply extracting the Debian package. (Note, I did not test this).

  1. ar x SomePackage.deb
  2. tar -xzf control.tar.gz
  3. nano control and edit the information
  4. tar -czf control.tar.gz conffiles control md5sums postinst postrm preinst prerm
  5. ar r SomePackage.deb control.tar.gz
  6. rm control.tar.gz data.tar.gz debian-binary conffiles control md5sums postinst postrm preinst prerm
  • Thanks Githlar!!! I have tried your second option and it worked "like magic". I appreciate your help. – user279465 May 11 '14 at 15:23
  • @user279465, would you accept this answer as it is the one that works for you. – user.dz Apr 20 '16 at 9:24
  • 1
    unix.stackexchange.com/a/138190/38647 suggests a way of unpacking/repacking the .deb file using dpkg-deb, and advises doing everything in a fakeroot to preserve permissions. – mwfearnley Nov 13 '18 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.