Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm trying to rebuild a package (specifically grub2) to overcome some bugs that have been fixed upstream but not fixed in Ubuntu, and have the package integrate into Ubuntu properly. The package is hosted in bzr both on Launchpad and GNU Savannah.

How can convert a "raw" upstream source package into an "Ubuntu" version and recompile/repackage it? I've worked out that I can get the latest Ubuntu version of the package source with apt-get source, but there are significant differences to the upstream version. What is the best course of action here?

share|improve this question

3 Answers 3

You may want to try this trick after installing bzr and bzr-builddeb:

bzr branch ubuntu:yourrelease/grub2
cd grub2
[ -d debian/patches ] && quilt pop -a
bzr commit -m 'reverting all patches' || :
bzr merge-upstream lp:grub2
dch -i
# Here edit the version info to match upstream..
bzr bd

That should build you a new grub2 from upstream source purely (no patches). You may find that you need some of those patches, so its worthwhile to look at the list and decide.

note that the 'ubuntu:yourrelease/grub2' may not work on older versions of bzr. If that balks, try 'lp:ubuntu/yourrelease/grub2'

share|improve this answer
yourrelase is precise, trusty, etc. as mentioned at – Ciro Santilli 六四事件 法轮功 包卓轩 Jul 25 at 11:42

It could be that the version of Grub that's packaged in Ubuntu is older than what is in the upstream Grub branch.

The Ubuntu branch will also have a "debian/" directory which contains Debian/Ubuntu-specific metadata for the package, and possibly some patches with backports of bug fixes or further integration for Ubuntu. For more information, read

share|improve this answer

For my own packaging requirement which is similar to the question, I followed this method:

You may want to focus on the pbuilder links in order to speed things up.

As for me, I followed the instruction up to step 5 in the method. Then I did:

apt-get install build-dep <package> #since I had not configured pbuilder
dpkg-buildpackage -k<key id> 
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.