I wish to maintain a local fork of a debian package. I need to patch a bug which will eventually be fixed in the official package, but not for some time.

How do I create a .deb package, and how do I use it, to get my bug fix used locally?

The package in question contains some script files.

1 Answer 1


It depends on whether there is a publically available git or subversion repository available. If so, it probably makes sense to use git to make a branch of the official repo.

Failing that, with any luck, the package uses something like dpatch or quilt, so you can just keep a patch in debian/patches/.

If you're really unlucky, you're going to have to deal with updating your patch every time a new package is released by hand. It might be worth using git for this anyway and importing every new build.

When building debian packages, make sure you have build-essential and devscripts packages installed.

To actually make the change, run

# apt-get source foo

Then change into the foo-1.2.3 directory and make you changes.

Then run

# debuild -us -uc -b

which will create the package. This will either build straight away or tell you dependencies you need to install first before you try again. The build packages will end up in the directory above the source.

I would highly recommend changing the package version number in the debian/changelog file, so you don't confuse your locally built package with the original. You can look at the dch tool to make editing this file easier.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .