1

I'm upgrading Ubuntu from 14.04 to 18.04. I ran

$ sudo do-release-upgrade

It exited with errors, relating to emacs and emacs24. I removed those packages with dpkg, and I would now like to complete the release upgrade. However, when I try to rerun the do-release-upgrade, I get the following error:

isaac@isaac-ThinkPad-T440s:~$ sudo do-release-upgrade
Traceback (most recent call last):
  File "/usr/bin/do-release-upgrade", line 11, in <module>
    from UpdateManager.Core.MetaRelease import MetaReleaseCore
  File "/usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py", line 25, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ImportError: /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0: symbol _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareERKS4_, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference

I get a similar error when I run apt or apt-get, but dpkg seems to be fine. What should I do?

1 Answer 1

0

The partial upgrade appears to have introduced some new code that expects a newer version of libstdc++ to exist. There are two solutions that may work for you:

Check if a newer libstdc++ exists on your disk

$ ls -lh /usr/lib/x86_64-linux-gnu/libstdc++.*
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -> libstdc++.so.6.0.25
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25

This shows on my system there is only one libstdc++ which is 6.0.25 - but for your system there might be multiple with the latest one not correctly linked (the -> means it's a symbolic link)

You can run this command to force the symbolic link to point to the newer one:

sudo ln -s libstdc++.so.6.x.x libstdc++.so.6

Replacing 6.x.x with the most recent version you have.

Download libstdc++ manually

Download libstdc++6_8-20180414-1ubuntu2_amd64.deb and install it using dpkg

wget 'https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-8/libstdc++6_8-20180414-1ubuntu2_amd64.deb'
dpkg -i libstdc++6_8-20180414-1ubuntu2_amd64.deb

If it complains it needs a dependency you will need to repeat the process above for all the packages listed as dependencies (libc6, gcc-8-base, etc.) They can be found here:

https://packages.ubuntu.com/bionic/libstdc++6

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .