22

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/ )?

19

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
| improve this answer | |
  • 1
    Maybe 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... – agc May 5 '16 at 14:00
  • ...except that apt-get install keeps complaining about the conflict, as you wrote earlier. – krlmlr Sep 8 '16 at 14:16
  • 1
    I 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. – krlmlr Sep 8 '16 at 14:26
  • 1
    Nope: apt-get install warns that parallel package won't be upgraded, but apt-cache policy doesn't show different versions, and even apt-get dist-upgrade won't touch the parallel package. So, upgrading parallel seems to be a process that has to be initiated consciously. Fine with me. – krlmlr Sep 8 '16 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. – agc Sep 9 '16 at 0:30
8

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.

| improve this answer | |
1

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/
| improve this answer | |
1

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).

| improve this answer | |

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.