Has anyone here had some experience creating a Debian / Ubuntu package? I am trying to backport the lammps package (http://packages.ubuntu.com/quantal/lammps) from Ubuntu 12.10 (Quantal) to Ubuntu 12.04

I only need it unofficially - just need a .deb package for convenience's sake when creating custom virtual machine images for deployment to IaaS platform.

Following the Ubuntu Packaging Guide at https://wiki.ubuntu.com/PackagingGuide , I can build successfully, except when I try to rebuild using the debuild command, I usually get this error:

 dpkg-source: error: aborting due to unexpected upstream changes, see
 /tmp/lammps_0~20120615.gite442279-1.diff.aie32n dpkg-source: info: you
 can integrate the local changes with dpkg-source --commit
 dpkg-buildpackage: error: dpkg-source --include-binaries -i -b
 lammps-0~20120615.gite442279 gave error exit status 2

Running 'make clean-all' at the src directory still does not solve the problem. Is there any way to completely clean off all the files that were generated during the build process, or to ask debuild to ignore any differences in the source files?

  • If "I only need it unofficially - just need a .deb package for convenience's sake" does not apply to you: Keep a large distance from the top answers. Read the answers from Stéphane Gourichon and dza down there.
    – Quasímodo
    Jun 18, 2022 at 0:09

8 Answers 8


Avoid the Debian bureaucracy by just building the binary: dpkg-buildpackage -b

  • 5
    This is not so useful if you intend to upload to debian.
    – jeremiah
    Jul 13, 2017 at 22:22
  • 11
    @jeremiah but very useful if you're tweaking a debian package for personal use.
    – Wyatt Ward
    Jan 8, 2018 at 20:28
  • Some of us don't need to upload to debian. Sometimes even after I make an immediate tarball with git archive --format=tar.gz --prefix=freeipa-4.9.8/ 4.9.8-1+devuan1> ../freeipa_4.9.8.orig.tar.gz from my current branch with git status empty, I still get failures that match the OP error message. This answer lets me skip that baloney and ensure my application still builds.
    – bgStack15
    Dec 29, 2021 at 16:09

This means you have applied changes to the unpacked upstream source which are not part of a patch in the debian/patches/ directory, or listed in the series file in there if they are; and/or there is some inconsistency in the state of quilt's application of the patches.

Looking at the mentioned file in /tmp will show you the changes in question.

  • Thank you very much for the quick answer!Is there a quick way to restore the changes done by 'make' instead of undoing all the changes record in the /tmp/*diff* file?
    – hanxue
    Dec 8, 2012 at 9:08

change the format in debian/source/format from 3.0 (quilt) to 3.0 (native) if you do not want to use quilt. This solved the problem for me anyway.

  • THIS! Quilt is impossible. Apr 10, 2015 at 19:47
  • 4
    I naively followed this comment as is. The net effect will be that your build will no longer use the patches in debian/patches. Could you please expand on the answer by explaining how you add the necessary magic to debian/rules to actually apply the patches? Apr 14, 2015 at 19:39

@Thomas Vander Stichele

I have come up with a workaround that uses the generated temporary file as a patch:

$ cp /tmp/path_to_diff_file_created_by_dpkg-source debian/patches/useful_name_of_applied_patch.patch
$ echo useful_name_of_applied_patch.patch >> debian/patches/series



I saw this problem when quilt incorrectly thought I had applied patches to my working copy (you can find its current status in the .pc folder). The fix in that case was to force quilt to pop all the patches with quilt pop -a -f.


This may happen if you did all the Debian "paperwork" but happened to have lingering artifacts from previous attempts. In particular, auto-generated changes to “config.sub”, “config.guess” and “Makefile”.

You could put this in debian/source/options:

# Don't store changes on autogenerated files
extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"

Ref: https://raphaelhertzog.com/2011/01/28/3-ways-to-not-clutter-your-debian-source-package-with-autogenerated-files/



Configure often modifies the source tree, you can list these files in


Example debian/clean


This issue usually appears during subsequent building of debian packages, although you may or may not have made changes to the original source during the first build. During the first time build, dpkg-source creates a <package-source>.orig.tar.{xz, gz, lzma} in the top-level directory. For eg. in the case of libva, you would find it as:

├── libva
├── libva_2.11.0.orig.tar.xz

Now when you make changes inside libva/ or try to build subsequent times, it unpacks this source tar.gz and tries to compare with the new build files, finding changes in the new build.

The solution is to remove the older source tar, create a new one for the subsequent build using:

dh_make --createorig -p libva_2.11.0

And continue building the deb pkgs using the commands that you have been doing. Usually it would be:

debuild -d -uc -us


dpkg-buildpackage -b -uc -us
  • Although this answer is correct, it conflates "a package with broken clean-up policy" and "a package whose source files you are actually and intentionally modifying". The solution to the former is not overriding the original tarball, but to the latter it may be if the package is for personal use only (as the poster says).
    – Quasímodo
    Jun 18, 2022 at 0:12

You must log in to answer this question.

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