7

A trivially conflicting package foo can be made to work with bar, by running dpkg --force-conflicts -i foo. But eventually it's time to upgrade, and 'apt-get' objects:

% apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 foo : Conflicts: bar but 0.2-1 is installed
E: Unmet dependencies. Try using -f.

Can apt-get be tweaked/forced to tolerate the (pretty much fixed) conflict, then upgrade?

(Quickie existence proof: uninstall foo, then upgrade, then reinstall foo as before. Therefore it is possible, the question is finding the least cumbersome mechanism.)


An example, but this question is not about any two particular packages.

For several years GNU parallel has had a trivial conflict with moretutils; each provides /usr/bin/parallel. dpkg can force co-existence:

# assume 'moreutils' is already installed, and 'parallel' is in
# apt's cache directory.
dpkg --force-conflicts -i /var/cache/apt/archives/parallel_20141022+ds1-1_all.deb

This creates a diversion, renames the moreutils version to /usr/bin/parallel.moreutils. Both programs work, until the user upgrades.

I tried an -o option, but that didn't bring on peace:

apt-get -o Dpkg::Options::="--force-conflicts" install parallel moreutils

Possible -o options number in the hundreds, however...

  • 1
    "Can apt-get be forced to tolerate the (pretty much fixed) conflict, then upgrade?" Sorry, it's not fixed. You need to fix it before doing anything else.And no, conflicting packages cannot be made to work with each other. And --forcing things is generally a bad idea unless you know what you are doing. – Faheem Mitha May 5 '16 at 16:41
  • @FaheemMitha, "it's not fixed" refers to what specifically? The dpkg level, the apt level or what? – agc May 5 '16 at 17:12
  • PS: I was informed (by @derobert) that this is a manifestion of Debian bug 749355. You should have mentioned that in the question. But you should still not try to make these packages co-exist. – Faheem Mitha May 5 '16 at 17:12
  • Both dpkg and apt are clearly unhappy with the current situation. And the only way to fix things is not have both of the packages installed. Thers is no good way to placate them, and trying to do so will not lead anywhere. – Faheem Mitha May 5 '16 at 17:14
  • @FaheemMitha, "this question is not about any two particular packages." – agc May 5 '16 at 17:15
5

Since OP asked for a list of commands (with which to change the relevant metadata of the package) in the comments to Gilles' answer, here it is:

# download .deb
apt download parallel
# alternatively: aptitude download parallel

# unpack
dpkg-deb -R parallel_*.deb tmp/

# make changes to the package metadata
sed -i \
  -e '/^Version:/s/$/~nomoreutconfl/' \
  -e '/^Conflicts: moreutils/d' \
  tmp/DEBIAN/control

# pack anew
dpkg-deb -b tmp parallel_custom.deb

# install
dpkg -i parallel_custom.deb

This is under the assumptions that the conflicts line only has moreutils as an entry (and without version restrictions) as was the case in my installation. Otherwise, use '/^Conflicts:/s/\(, \)\?moreutils\( [^,]\+\)\?//' as the second sed script to only remove the relevant part of the line and support version restrictions.

Your installed package won't be overwritten by newer versions from the repository and you have to manually repeat this procedure for every update to the GNU parallel package if you want to keep this package up-to-date.

  • 1
    Well, that works but apt upgrade complains that parallel (the same version as the just tweaked .deb) has been kept back. Still, that is an improvement on the dpkg --force-conflicts method, where every upgrade breaks one of the programs -- the phk method allows every other upgrade. – agc Oct 31 '16 at 2:09
3

A conflict between packages is harmful in and of itself. When you force dpkg to install the conflicting packages, this may not cause any other harm if the conflict was declared for no good reason, but the packages are still conflicting. APT works hard to resolve conflicts when installing packages and it doesn't have a list of conflicts to ignore. You can't solve this by making it pass different options to dpkg: the problem is that the conflicts make APT's own job impossible.

Never install conflicting packages unless it's a temporary state to get out of a situation where APT breaks down. Don't run APT until you've worked with dpkg to get out of the conflicting situation.

If you want to install conflicting packages, modify them first to remove the Conflict: declaration, in addition to resolving whatever problems motivated the conflict declaration.

  • could you briefly elaborate on how you'd "modify them first to remove the Conflict: declaration"? – agc May 6 '16 at 7:13
  • 1
    @agc Either rebuild the package, or modify the binary package by opening it in an editor such as Emacs and editing the control file, or modify the binary package by unpacking it, editing the control file and repacking it. – Gilles 'SO- stop being evil' May 6 '16 at 10:18
  • thanks, but please be more specific, preferably using sed (or something like it) instead of a GUI editor. The goal is a relatively foolproof one-liner, as far as might be possible. – agc Sep 9 '16 at 12:24

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.