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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I develop (or maintain) a package, I've gotten several bug reports along the lines of:

dpkg: error processing /var/cache/apt/archives/libjline-java_1.0-1_all.deb (--unpack):
 trying to overwrite '/usr/share/java/jline.jar', which is also in package scala 2.9.2-400
Errors were encountered while processing:

but I haven't found a way to prevent/find them before someone hits them. How can I prevent these file conflicts/collisions before this even happens?

share|improve this question
up vote 8 down vote accepted

To prevent this with Ubuntu packages you can use apt-file and just run all your package against the file database that can be found using apt-file:

apt-file search -D your_deb_file.deb

This will require that you have apt-file installed and updated. Then add the package name (and possibly version) to the Break or Conflict fields, in the respective package entries in the control file. That should be enough.

Now, some would want to replace Ubuntu files with their own, like offering a newer version of the applications, in such cases the best is to use the same debian/ files as the Ubuntu packages. This will create your package with the same shape as upstream and file collisions can be adverted.

Note: if the user likes to mix repositories from different maintainers, nothing you can do.

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.