2016-08-13

Upgrading from Ubuntu 14.04 to 16.04

Upgraded from Ubuntu 14.04 to 16.04 on one of my homelab test-servers today.

After the upgrade, running 'apt-get update' resulted in this error:

# apt-get update
apt-get: relocation error: /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




To fix this, I tried to manually install libstdc++6:

Download:

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


Install:

# dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.2_amd64.deb

 But this failed with:

dpkg: warning: downgrading libstdc++6:amd64 from 6.1.1-3ubuntu11~14.04.1 to 5.4.0-6ubuntu1~16.04.2
dpkg: regarding libstdc++6_5.4.0-6ubuntu1~16.04.2_amd64.deb containing libstdc++6:amd64:
 libstdc++6:amd64 breaks libboost-date-time1.55.0
  libboost-date-time1.55.0:amd64 (version 1.55.0-1) is present and installed.


dpkg: error processing archive libstdc++6_5.4.0-6ubuntu1~16.04.2_amd64.deb (--install):
 installing libstdc++6:amd64 would break libboost-date-time1.55.0:amd64, and
 deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
 libstdc++6_5.4.0-6ubuntu1~16.04.2_amd64.deb



So, ran this a few times, to remove libboost libraries:

# for p in $(dpkg -l |grep libboost|awk '{print $2}'); do dpkg --purge "$p" ; done

To do a  dry-run (ie check what would be removed but not actually do it), add an echo infront of dpkg:

Dry-run (test without removing)

# for p in $(dpkg -l |grep libboost|awk '{print $2}'); do echo dpkg --purge "$p" ; done



And then could finally run:

# dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.2_amd64.deb
dpkg: warning: downgrading libstdc++6:amd64 from 6.1.1-3ubuntu11~14.04.1 to 5.4.0-6ubuntu1~16.04.2
(Reading database ... 147174 files and directories currently installed.)
Preparing to unpack libstdc++6_5.4.0-6ubuntu1~16.04.2_amd64.deb ...
Unpacking libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.2) over (6.1.1-3ubuntu11~14.04.1) ...
Setting up libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...


And apt-get was working again



4 comments:

  1. Hey hope you see this soon...
    I am having the same problem right now, so I tried to run this as you said
    "for p in $(dpkg -l |grep libboost|awk '{print $2'}); do dpkg --purge "$p" ; done"

    It asked me to be superuser, so I did, but its still not happy saying there is a problem with the "do" statement.

    I ran it through a online bash syntax checker and this is what I got:
    for p in $(dpkg -l |grep libboost|awk '{print $2'}); do dpkg --purge "$p" ; done
    ^-- SC1083: This } is literal. Check expression (missing ;/\n?) or quote
    Help me plz. What should I do, I want my apt-get back ;(

    ReplyDelete
    Replies
    1. Hi,

      Try to replace this part "$2'}" with "$2}'", so it looks like this:

      # for p in $(dpkg -l |grep libboost|awk '{print $2}'); do dpkg --purge "$p" ; done

      You can also try this first to see what packages will be remove, without actually removing:

      # echo "Try, without removing - just echo the commands"
      # for p in $(dpkg -l |grep libboost|awk '{print $2}'); do echo dpkg --purge "$p" ; done

      Does this work for you?

      Delete
  2. Same problem here. Followed the steps but I was unable to solve the problem. Finally I will have to reinstall Ubunto on my laptop. Have it since Ubuntu 10.04, upgraded to 12.04, then to 14.04 with no problems at all. Upgrade to 16.04 ruined it!

    ReplyDelete