Ubuntu: How to solve package conflicts?



Question:

I would like to install both packages libsigc++-2.0-0c2a and libsigc++-2.0-0v5 at the same time, in order to run certain software.

Apparently, however, the packages are conflicting and

sudo apt-get install libsigc++-2.0-0v5 libsigc++-2.0-0c2a  

results in

The following packages have unmet dependencies.  libsigc++-2.0-0v5 : Conflicts: libsigc++-2.0-0c2a but 2.2.10-0.2ubuntu2 is to be installed  E: Unable to correct problems, you have held broken packages.  

Is there a common strategy to approach such situations? Shouldn't the "Version numbering" solution apply here?


Solution:1

Problem

I agree with MichaelW that it contains same lib file with same version. However, the error you got is not related that but it is packages version conflict declared in one of the packages:

$ dpkg --info Downloads/libsigc++-2.0-0v5_2.4.1-2_amd64.deb  ...   Conflicts: libsigc++-2.0-0c2a   Replaces: libsigc++-2.0-0c2a  ...  

If those lines are removed, we got the error related same files overwriting, similar to this one:

Unpacking libjline-java (from .../libjline-java_1.0-1_all.deb) ...  dpkg: error processing /var/cache/apt/archives/libjline-java_1.0-1_all.deb (--unpack):   trying to overwrite '/usr/share/java/jline.jar', which is also in package scala 2.9.2-400  Errors were encountered while processing:   /var/cache/apt/archives/libjline-java_1.0-1_all.deb  E: Sub-process /usr/bin/dpkg returned an error code (1)  

Error Source: dpkg error: "trying to overwrite file, which is also in..."

As they are compiled to same version, it is not possible to put them together neither changing name manually will help. Tools on repository had already compiled to use libsigc-2.0.so.0.

Solution

Here is an easy solution with test case.

Test case:

I looked for package the depends on same library using:

$ apt-cache rdepends libsigc++-2.0-0v5  ...    libatkmm-1.6-1v5    inkscape    gparted    gnome-system-monitor    aptitude  

Verify that the contained binary really depends on it, using:

$ dpkg -L gnome-system-monitor | grep /bin/  /usr/bin/gnome-system-monitor    $ ldd `which gnome-system-monitor` | grep libsigc      libsigc-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libsigc-2.0.so.0 (0x00007f9491bec000)  

Instructions:

  1. Create a folder to contain the external shared lib (the other version you are unable to install), example:

    mkdir ~/Desktop/sand_box/local_so_lib_test  
  2. Extract the library fro the package

    $ dpkg-deb --extract ~/Downloads/libsigc++-2.0-0c2a_2.2.10-0ubuntu2_amd64.deb /tmp/libsigc  $ cp -a /tmp/libsigc/usr/lib/x86_64-linux-gnu/* ~/Desktop/sand_box/local_so_lib_test  $ ls -l  total 20  lrwxrwxrwx 1 sneetsher sneetsher    20 Dec 12  2011 libsigc-2.0.so.0 -> libsigc-2.0.so.0.0.0  -rw-r--r-- 1 sneetsher sneetsher 18488 Dec 12  2011 libsigc-2.0.so.0.0.0  
  3. Start the special dependent tools, by setting LD_LIBRARY_PATH

    $ LD_LIBRARY_PATH=~/Desktop/sand_box/local_so_lib_test gnome-system-monitor  

Check:

$ LD_LIBRARY_PATH=~/Desktop/sand_box/local_so_lib_test ldd /usr/bin/gnome-system-monitor | grep libsigc      libsigc-2.0.so.0 => /home/sneetsher/Desktop/sand_box/local_so_lib_test/libsigc-2.0.so.0 (0x00007fabbe960000)    $ LD_LIBRARY_PATH=~/Desktop/sand_box/local_so_lib_test gnome-system-monitor &  $ lsof -c "gnome-system-mo" | grep libsigc  gnome-sys 28655 sneetsher  mem       REG                8,5    18488  2752572 /home/sneetsher/Desktop/sand_box/local_so_lib_test/libsigc-2.0.so.0.0.0  


Solution:2

Both packages contain the same files:

  • /usr/lib/x86_64-linux-gnu/libsigc-2.0.so.0
  • /usr/lib/x86_64-linux-gnu/libsigc-2.0.so.0.0.0

You can find this in the package details searching in the Ubuntu packages: http://packages.ubuntu.com/

e.g. http://packages.ubuntu.com/wily/amd64/libsigc++-2.0-0v5/filelist http://packages.ubuntu.com/precise/amd64/libsigc++-2.0-0c2a/filelist

So the confilct is caused by the same files in the packages. What should the system do now? Since it can't decide it, it displays the conflict.


Solution:3

try sudo apt-get build-dep libsigc++-2.0-0v5 libsigc++-2.0-0c2a


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »