When I do sudo apt-get -f install I am getting

Preparing to unpack .../libstdc++6_8.1.0-5ubuntu1~14.04_amd64.deb ...
Unpacking libstdc++6:amd64 (8.1.0-5ubuntu1~14.04) over (5.4.0-6ubuntu1~16.04.10) ...
dpkg: error processing archive /var/cache/apt/archives/libstdc++6_8.1.0-5ubuntu1~14.04_amd64.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libstdc++6', which is different from other instances of package libstdc++6:amd64
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)}

I'm using Ubuntu 14.04.5

This is probably because of a conflict with libstdc++. (it happened when I was trying to install adobe acrobat) How/where do I find the right version of libstdc++6 and how to uninstall the broken version?

The output of apt-cache policy libstdc++6:i386 is

  Installed: 8.1.0-5ubuntu1~14.04
  Candidate: 8.1.0-5ubuntu1~14.04
  Version table:
 *** 8.1.0-5ubuntu1~14.04 500
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty/main i386 Packages
        100 /var/lib/dpkg/status
     5.4.0-6ubuntu1~16.04.11 8500
        500 http://mirror.****/ubuntu xenial-updates/main i386 Packages
     5.4.0-6ubuntu1~16.04.10 500
        500 http://mirror.****/ubuntu xenial-security/main i386 Packages
     5.3.1-14ubuntu2 500
        500 http://mirror.****/ubuntu xenial/main i386 Packages

(I have snipped the full IP address when I wrote **** above)

$ dpkg --print-foreign-architectures is

Output of dpkg -l libstdc++6 is

| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                 Version         Architecture    Description
iU  libstdc++6:amd64     5.4.0-6ubuntu1~ amd64           GNU Standard C++ Library v3
iF  libstdc++6:i386      8.1.0-5ubuntu1~ i386            GNU Standard C++ Library v3

Output of grep -v "#" /etc/apt/sources.list:

deb http://mirror**/ubuntu/ xenial main restricted
deb-src http://mirror**/ubuntu/ xenial main restricted

and so on so forth.
Will the problem get solved if I manually edit this file and change xenial to trusty (running apt-get-clean did not help fix this)

When I run sudo apt-get install --reinstall libstdc++6:i386, I get:

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:
 libstdc++-5-dev : Depends: libstdc++6 (>= 5.5.0-12ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.10 is to be installed
 libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.10) but 5.5.0-12ubuntu1~14.04 is to be installed
              Breaks: libreoffice-core (<= 1:4.4.4~rc3-0ubuntu1) but 1:4.2.8-0ubuntu5.1 is to be installed
              Breaks: libstdc++6:i386 (!= 5.4.0-6ubuntu1~16.04.10) but 8.1.0-5ubuntu1~14.04 is to be installed
 libstdc++6:i386 : Breaks: libstdc++6 (!= 8.1.0-5ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.10 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

and I cannot run apt-get -f install for the same reason as mentioned at the beginning of the thread. Let me know what can be done.

  • What does apt-cache policy libstdc++6:i386 output? – Stephen Kitt Mar 12 at 6:14
  • Any ideas/suggestions on what to do next to fix? As I am still lost. many thanks – Shantanu Mar 16 at 11:09
  • I’m not sure what’s going wrong here. Could you show the output of dpkg --print-foreign-architectures and of dpkg -l libstdc++6? Please edit your question to add the results, they’ll be more readable than in a comment. – Stephen Kitt Mar 16 at 12:02
  • I have answered above by re-editing my original message. Hopefully now it is clearer. – Shantanu Mar 19 at 18:05
  • Again another plea for SOS as I cannot forge ahead without a fix to this problem – Shantanu Mar 26 at 5:10

Looks like your /etc/apt/sources.list is badly messed up. You have somehow ended up with Xenial (16.04) repos enabled on your Trusty (14.04) system. This is obviously causing weird package conflicts like this.

Just fix/clean up your repository configuration, run apt-get clean and everything should start working again.

  • I ran apt-get clean, but it did not make any difference (with no diagnostic message) and I still get the same error when I run apt-get -f install – Shantanu Apr 8 at 6:33
  • @Shantanu Have you fixed the sources.list first? – TooTea Apr 8 at 7:35
  • Yes, but even after that apt-get clean runs without any message. I still get the same error with apt-get -f install (Note that the output of apt-cache policy libstdc++6:i386 now only shows the trusty packages.However output of dpkg -l libstdc++6 is same as before). Do I need to remove the newer version of libdst++ which has been installed? Thanks for all the help – Shantanu Apr 9 at 10:52
  • Oh, I didn't notice that you have the xenial package installed. Yes, you need to get rid of that. apt-get install --reinstall libstdc++6:i386 should help. – TooTea Apr 9 at 11:25
  • I ran the above command, but still a problem (see the original message where the full output is given) – Shantanu Apr 12 at 11:38

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.