Can I make the package manager resolve the conflict e.g. by renaming the binary (e.g. parallel → gparallel) or installing to a different place (e.g. /usr/ → /usr/local/ )?
4 Answers
For Ubuntu v17.04 ("Zesty Zapus") and Debian v9 ("Stretch"), (2017 or newer), or distros based upon those versions, please read Bryan Larsen's answer first, which should be sufficient.
For versions from before 2017, read on...
Use dpkg
to force the install; parallel gets along nicely with moreutils -- it renames moreutils' parallel
util to parallel.moreutils
. When the install is done both programs (GNU and moreutils) are available.
NB: if any user scripts call the old moreutils parallel
, change those scripts to use the longer name.
Details: Fetch parallel package (without installing or removing anything). Then using compgen
, (a bash
internal command), find parallel package in archive. If there's more than one, use the latest. Force that package to install, despite conflicts.
apt-get --assume-yes --download-only install parallel &&
ls --sort=version $(compgen -f /var/cache/apt/archives/parallel) |
tail -n 1 | xargs dpkg --force-conflicts -i
How to view the resulting diversions:
dpkg-divert --list 'par*'
Output:
diversion of /usr/share/man/man1/parallel.1.gz to /usr/share/man/man1/parallel.moreutils.1.gz by parallel
diversion of /usr/bin/parallel to /usr/bin/parallel.moreutils by parallel
See how both binary executables are available:
compgen -c parallel | xargs which | xargs ls -l
Output:
-rwxr-xr-x 1 root root 240814 Oct 31 2014 /usr/bin/parallel
-rwxr-xr-x 1 root root 10592 Jul 21 2015 /usr/bin/parallel.moreutils
-
1Maybe not! This used to work OK, but on a Lubuntu box, everything installs, but apt-get keeps wanting to get rid of one the parallels... probably needs another override. More later...– agcMay 5, 2016 at 14:00
-
...except that
apt-get install
keeps complaining about the conflict, as you wrote earlier.– krlmlrSep 8, 2016 at 14:16 -
1I edited
/var/lib/dpkg/status
to remove the conflict. Searched for "Conflicts: moreutils", deleted this line. Source: superuser.com/a/815371/99136. Seems to work now, but I fear an update of the "parallel" package will break things again.– krlmlrSep 8, 2016 at 14:26 -
1Nope:
apt-get install
warns thatparallel
package won't be upgraded, butapt-cache policy
doesn't show different versions, and evenapt-get dist-upgrade
won't touch theparallel
package. So, upgradingparallel
seems to be a process that has to be initiated consciously. Fine with me.– krlmlrSep 8, 2016 at 14:31 -
@krlmlr, that's a new one on me... BTW, if you'd be so kind as to post the above trick here Set apt-get options to tolerate harmless 'dpkg --force-conflicts' kludge?, I'd upvote it.– agcSep 9, 2016 at 0:30
This conflict is solved in Ubuntu 17.04 and Debian Stretch.
If you install parallel & moreutils you get the GNU parallel
as /usr/bin/parallel
and moreutil's parallel
as /usr/bin/parallel.moreutils
. If you only install moreutils, it provides /usr/bin/parallel
.
If you're using an older version of Ubuntu or Debian, you could download and install the .deb's from a newer version: they install & work just fine.
I guess, the easiest route would be to install one of the packages normally (e.g. parallel
) and just extract another one to the custom path:
$ sudo apt-get install libio-pty-perl libipc-run-perl
$ sudo apt-get download moreutils
$ dpkg -x moreutils_0.54-1_amd64.deb /tmp/moreutils
$ cd /tmp/moreutils/usr/bin/
GNU parallels is just a perl script, so you could just copy it somewhere useful (e.g. /usr/local/bin/gnu-parallel).
(Just check the perl dependencies).