5

In order to install tmux 2.1, I needed to install libtinfo5 version 6, I did this by downloading a .deb archive containing libtinfo5 and installing directly with command:

sudo dpkg -i libtinfo5_6.0+20160213-1ubuntu1_amd64.deb

This satisfied tmux 2.1's dependency and tmux installed ok.
Now I tried to install vnstat using

sudo apt-get install vnstat 

apt-get error exited with the following

$ sudo apt-get install vnstat
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:
 libncurses5 : Depends: libtinfo5 (= 5.9+20150516-2ubuntu1) but 6.0+20160213-1ubuntu1 is to be installed
 libncursesw5 : Depends: libtinfo5 (= 5.9+20150516-2ubuntu1) but 6.0+20160213-1ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

My understanding has always been that Ubuntu's package management system was capable of installing and managing multiple versions of the same package, for situations exactly like this. In other words apt/dpkg recognises

  • tmux needs libtinfo5 - version 6 to work
  • vnstat needs libtinfo5 - version 5 to work

Then apt/dpkg say's ok, I'll install both versions.
I can see how certain programs like a system binary, e.g. bash or ls can only be installed once as most invocations simply say bash -c "<command>" and not bashv.3.2 -c "<command>".
So my question is can the package manager install and manage multiple dependencies?, or is this just not possible because, like in the bash example above, most programs make a call to the dependency by the dependencies name without specifying version. In which case the issue is beyond the control of the package manager (i.e. its more of a programming compilation/configuration/organisation issue) and the package manager gives up at that point?

  • You should read up on snap packages. – TheWanderer Apr 17 '16 at 23:43
  • You might even be able to build your own snaps for tmux and vnstat yourself, if they haven't already been built. You do need 16.04 though. developer.ubuntu.com/en/snappy/build-apps – TheWanderer Apr 17 '16 at 23:47
  • @Zacharee1 thanks for the link. I totally see why the Snaps system is necessary now. The PHP community had the same issue where PEAR/PECL is analogous apt/dpkg and Snaps is analogous to composer – the_velour_fog Apr 18 '16 at 0:10
  • @Zacharee1 The newer version of tmux is also already in Ubuntu 16.04. If one wants it on 14.04, it would probably be better to just rebuild the source package from 16.04, or request a backport of the new version, to the backports archive for 14.04. – dobey Apr 18 '16 at 0:31
  • But what about all the packages that are managed my "alternatives". Java is an example, and you can have many versions of it. Python is another one, not managed by "alternatives" but by other means: Python3 and Python2 are considered different languages. – jgomo3 Jan 16 '17 at 18:38
1

No, it is not possible to have two versions of the same package, because there will be conflicting files. If a library is capable of being installed in two different versions at the same time is a different matter. If you're brave, you could get the source code for one version and see if you can install that to a different directory. This could very well mess up your system in nasty ways. It could also just plain not work. Dpkg won't be satisfied, so you'll have to get the source for one of the programs and compile that too. But bear in mind that once you start compiling programs yourself, you can cause yourself all kinds of problems.

  • Thanks, so basically you are saying I would need to compile from source (most likely independent of the package manager) and mostly self contained in its own monolithic directory - not following the [linux file system hierarchy]( en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) then use a local instance of the library /dependency , and modify the source to include this local library, not the system library. At which point I, as you say once you start compiling programs yourself, you can cause yourself all kinds of problems. – the_velour_fog Apr 18 '16 at 0:03
  • That's exactly right. I'm afraid you've been caught in the middle of dependency hell. Usually in cases like yours where different programs depend on different versions of the library, the different versions of the library are shipped as different packages. A good example is libjpeg: there's a libjpeg8, libjpeg9, and libjpeg62. But that is an issue for the package maintainer. – Stephen Angelico Apr 18 '16 at 0:15
1

No, you can not have different versions of the same package installed at the same time. Usually dependencies are expressed as at least version X. For packages that are all built from the same source however, the dependency is often exact. This is what you have run into. libncurses5 and libtinfo5 are both built from the ncurses source package. If you want to upgrade one of the packages built from this source, you must upgrade all of them, so you simply need to get and install the same version of the other packages built from this source, so they are all on the same version.

  • thanks, yes running tmux 2.1 wasn't critical for me, so I was able to fix this issue by simply removing tmux 2.1 with dpkg --force-all then use apt to downgrade back to version 5.xx of libtinfo5, and install the distro provided tmux. But this issue was trivial what I was really interested to know about is the fact that two packages can't co-exist within Ubuntu's package managed ecosystem. This obviously has major consequences, but also explains so many issues and comments etc that previously didn't make sense! – the_velour_fog Apr 18 '16 at 2:20
  • @the_velour_fog, note that some packages ( mostly libraries, bug gcc is usually an application that does this ) are given a new name and store their files in a different place so that you can install two versions at the same time. This is mostly done when a library makes a change that is not backward compatible. In that case you might see a "libfoo4" whose version is 4.5.6, and a "libfoo5" package, whose version is 5.1.2, and you can have both installed so that packages that need the older, incompatible version of the library can still get it. – psusi Apr 18 '16 at 22:26

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.