apt-get relocation error after upgrade to 16.04

I just upgraded to Ubuntu xenial, 16.04. When I try to do apt-get, I get the error

apt-get: relocation error: /usr/lib/i386-linux-gnu/libapt-pkg.so.5.0: symbol [long symbol omitted] version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference

I tried solutions at apt: relocation error: version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference:

wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb
sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb

but the system complains this is going back to an old version of libstdc++6:

dkpg: warning: downgrading libstdc++6:i386 from 8.1.0-5ubuntu1!14.04 to 5.4.0-6ubuntu~16.04.10

and refuses to continue because libstdc++6:i386 break libkolabxml1.

That page also suggests using ppa-purge (but it's not installed) and apt-add-repository (but apt isn't working).

I have also tried installing aptitude itself, the xenial version for i386. It complains that it needs libcwidget3v5 and libsigc++-2.0-0v5. But it can't install these because it breaks dependencies if it tries.

When I've run across a mess of dependencies like this before, it turned out I had something at the top level that was of the wrong sort.

What's the fix? I'd imagine if I can get apt working, I can get other things repaired. I'd be willing to run the upgrade process again, but do-release-upgrade fails because it can't use apt.


Some further requested detail.

Output of dpkg --print-architecture: i386

Output of dpkg --print-foreign-architecture: [no output]

Output of ldd /usr/lib/i386-linux-gnu/libapt-pkg.so.5.0 | grep local: [no output]

Output of ldd /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep local: [no output]


Solution 1:

Try forcing the installation of libstdc++6 by using:

dpkg -i --force-downgrade --force-depends libstdc++6...

If they don't work, you can also try --force-all.