I am creating a Debian package foo which needs to replace an existing package bar on systems on which it is installed.

I've read:


And concluded that the correct clauses in the DEBIAN/control should look like:

Provides: foo
Conflicts: bar
Replaces: bar

However, when I try to install the foo package on a system that already has bar installed, the system balks because foo conflicts with bar.

If I remove the Conflicts: bar entry then dpkg allows both packages to be installed side-by-side, which is a problem since foo must replace bar.

What are the proper control file clauses to achieve this?

I've tried Breaks instead of Conflicts:

dpkg: regarding foo_DEV-22._i386.deb containing foo:
 foo breaks bar
  bar (version is present and installed.
  bar provides bar and is present and installed.
dpkg: error processing foo_DEV-22._i386.deb (--install):
 installing foo would break existing software
Errors were encountered while processing:
  • Possibly instead of Conflicts you should use Breaks
    – Dani_l
    Oct 8 '15 at 12:51
  • I tried 'Replaces', and that seems to fix the broken pipe error on its own that'd be caused by two packages installing the same file, as long as the one to replace the other is the later version, otherwise, the package with the latest version will be the one that controls the files installed. Jul 5 '17 at 16:41

dpkg is a low level tool. To get the desired effect the package should be put into a repo and added to sources.list(5) then apt install foo will do the right thing.


Why not to rename it the existent package beforehand and later replace it with the one you want?

To this end you have to methods/ways as per Debian official wiki page below:

  • Well, method 1 (provides/replaces/conflicts) is the one that I have tried, that doesn't work. dpkg just refuses to install foo because it conflicts with bar. I haven't got a clue about what method 2 is asking me to do. If you can explain it more clearly, that would be greatly appreciated.
    – spierepf
    Oct 8 '15 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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