Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running an Ubuntu 12.04 LTS server. I currently have an issue where one of my used packages has an annoying bug. Instead of removing it and just building it from source, I want to integrate it into Ubuntus/Debians package management.

Coming from ArchLinux we did this by copying the original PKGBUILD and changing it in such a way that it compiles the new package. This is a very simple process but it informs the package manager about this package even though it is in no local repositories.

Is there a similar way for Ubuntu/Debian? Can I easily base my package on the outdated Ubuntu version and install this package instead of the original repository one?

Note: The concerning software is libvirt (I need 0.9.13 at least, 12.04 runs 0.9.8) and while I would appreciate a solution for this particular package in the comments, I am looking for a more general solution for such problems should they arise in the future.

Contrary to questions How can I manually assemble my own package “the hard way”? and What is the simplest Debian Packaging Guide? I am not interested in creating a new package but instead using existing resources and update them to a newer version.

share|improve this question
possible duplicate of How to get my software into Ubuntu? –  bodhi.zazen Jan 27 at 22:13
This doesn't answer your question, but updated libvirt is in the Cloud Archive: wiki.ubuntu.com/ServerTeam/CloudArchive –  Jorge Castro Jan 27 at 22:14
You can always download the older package version from wherever, and then install it by hand, without repackaging everything. –  Thomas W. Jan 27 at 22:45
@bodhi.zazen he wants to fix a bug locally no submitting a new package to Ubuntu. –  Braiam Jan 29 at 1:47
@Braiam Thanks, I suppose I misunderstood "I want to integrate it into Ubuntus/Debians package management." –  bodhi.zazen Jan 29 at 15:55

1 Answer 1

up vote 1 down vote accepted

I would download the source and the build dependencies for the Ubuntu version first:

apt-get install dpkg-dev
apt-get build-dep <package>
apt-get source <package>

The unmodified, upstream source the Ubuntu version is based on will be in a file called <pkg>_<ver>.orig.tar.gz (compression scheme may vary) - I would decompress this to one directory (let's call it "dir A"), then download the source to the bug-fixed version into another directory ("dir B"), and then generate a patch for what's changed:

diff -Nur <dirA> <dirB> >/tmp/upgrade.patch

Then change to the directory where apt-get source decompressed the modified Ubuntu version, and apply the patch

patch -p1 </tmp/upgrade.patch

Assuming there weren't many changes between the two upstream versions, and they didn't conflict with any of the Ubuntu packager's changes, this should work. Then edit debian/changelog in the Ubuntu package to give it a new version number, and dpkg-buildpackage should build you a custom version..

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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