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
- 636
- 5
- 16
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.
- 222
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).
- 281
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/