1

When I use apt I have problems:

$ sudo apt-get update
apt-get: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by apt-get) apt-get: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0)

However, installing new apt outputs:

dpkg: regarding .../apt_1.2.10ubuntu1_amd64.deb containing apt:
apt breaks apt-utils (<< 1.1.3)
apt-utils (version 1.0.1ubuntu2) is present and installed.

dpkg: error processing archive /home/anawasreh/Downloads/apt_1.2.10ubuntu1_amd64.deb (--install):
 installing apt would break apt-utils, and
 deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
 /home/anawasreh/Downloads/apt_1.2.10ubuntu1_amd64.deb
(13:13:21)anawasreh@readonly@anawasreh(-)

Even if I try to download the missing lib:

$ sudo apt-get install libstdc++6

apt-get: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
`GLIBCXX_3.4.20' not found (required by apt-get) apt-get:
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not
found (required by /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0)

So I'm stuck there and can't remove, update, or correct apt at all.

Melebius
  • 11,431
  • 9
  • 52
  • 78
Aladdin
  • 121

3 Answers3

3

You could copy libstdc++.so.6 from another Ubuntu installation.

In a 14.04 virtual machine, I removed libstdc++.so.6 and got the same error as you. Then I copied it from my 16.04 host, and apt worked again. You could use a Live CD for this.

Alternatively, download the the right file for your version:

14.04: https://bsre.stackstorage.com/index.php/s/JVNxNO3HWBA4HSa
16.04: https://bsre.stackstorage.com/index.php/s/L394ttygh55cR1W

Then open a Terminal window using Cntrl + Alt + T

  1. Type cd ~/Downloads and press enter
  2. Type md5sum libstdc++* and press enter
  3. Make sure you see either of the following:

    aa688ac2f4c90a023c2cbd1dd21d4ccc libstdc++1404.so.6 68dbd855c3213cae1a41375c25bf6884 libstdc++1604.so.6

  4. Then rename the file using sudo mv libstdc++* libstdc++.so.6
  5. Move the file: sudo mv libstdc++.so.6 /usr/lib/x86_64-linux-gnu/
grooveplex
  • 2,486
0

This was little complicated, I dont remember what exactly I had done when I had this problem.

Maybe this can help:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

This may not work if you dont have python software properties installed.

So,try updating your repositories and PPAs to default. follow this link to know how to do it: How do I restore the default repositories?

  • Can't use apt-get sudo apt-get update apt-get: error while loading shared libraries: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: invalid ELF header – mvladk Jan 31 '19 at 08:08
0

I also had the same problem earlier. I fixed it by downloading libstdc++6 debian package from here and later did a manual install using 'dpkg'

sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.1_i386.deb

After this it apt was working fine