I was facing the same issue while upgrading from 14.04 LTS
to 16.04 LTS
. You need to track the broken package and recursively try re-installing or upgrading it.
First remove all dependent libraries (autoremove
) and install all missing libraries using sudo apt-get -f install
(-f
means --fix-missing
)
sudo apt-get autoremove
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade
Install ubuntu toolchain
from PPA
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
Then install aptitude
.
sudo apt install aptitude
aptitude
package manager is much handy installer than apt-get
. It also suggestions to resolve conflicting dependencies and broken packages. The following was the conflicts in my system. They may differ from your's but the high level method to resolve them would be the same.
$ sudo aptitude -f install build-essential
The following NEW packages will be installed:
build-essential cpp{a} cpp-5{a} g++{a} g++-5{a} gcc{a} gcc-5{a} libasan2{a} libcc1-0{ab}
libcilkrts5{a} libgcc-5-dev{a} liblsan0{ab} libmpx0{a} libstdc++-5-dev{a}
The following packages will be upgraded:
gcc-5-base libstdc++6{b}
2 packages upgraded, 14 newly installed, 0 to remove and 5 not upgraded.
Need to get 29.6 MB of archives. After unpacking 100 MB will be used.
The following packages have unmet dependencies:
liblsan0 : Depends: gcc-9-base (= 9.3.0-10ubuntu2~16.04) but 9.3.0-11ubuntu0~14.04 is installed.
libcc1-0 : Depends: gcc-9-base (= 9.3.0-10ubuntu2~16.04) but 9.3.0-11ubuntu0~14.04 is installed.
libstdc++6 : Depends: gcc-9-base (= 9.3.0-10ubuntu2~16.04) but 9.3.0-11ubuntu0~14.04 is installed.
Aptitude gives sometimes provide a viable potential solutions. Such as upgrading or downgrading other libraries to solve the conflict. In my case there was no solution. Hence I need to further trace down the dependencies.
As build-essential
needs gcc-5
.
$ sudo apt-get -f install gcc-5
The following packages have unmet dependencies:
gcc-5 : Depends: cpp-5 (= 5.5.0-12ubuntu1~16.04) but it is not going to be installed
Depends: gcc-5-base (= 5.5.0-12ubuntu1~16.04) but 5.4.0-6ubuntu1~16.04.12 is to be installed
Depends: libcc1-0 (>= 5.5.0-12ubuntu1~16.04) but it is not going to be installed
Depends: libgcc-5-dev (= 5.5.0-12ubuntu1~16.04) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
But gcc-5
in turn depends on cpp-5
$ sudo apt-get -f install cpp-5
The following packages have unmet dependencies:
cpp-5 : Depends: gcc-5-base (= 5.5.0-12ubuntu1~16.04) but 5.4.0-6ubuntu1~16.04.12 is to be installed
cpp-5
depends on gcc-5-base
. Here you can see there is a specific conflict. Aptitide gives multiple choices to solve the conflict. In my case upgrading the libstdc++6
solvd the problem.
$sudo aptitude -f install gcc-5-base
The following packages will be REMOVED:
gcc-5-base{u}
0 packages upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
Need to get 0 B of archives. After unpacking 67.6 kB will be freed.
The following packages have unmet dependencies:
libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.12) but it is not going to be installed.
open: 115; closed: 488; defer: 35; conflict: 58 .The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) gcc-5-base [5.4.0-6ubuntu1~16.04.12 (now, xenial-security, xenial-updates)]
Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:
Upgrade the following packages:
1) libstdc++6 [5.4.0-6ubuntu1~16.04.12 (now, xenial-security, xenial-updates) -> 9.3.0-10ubuntu2~16.0
Finally, now the conlict is resolved try installing build-essentials
again.
$ sudo aptitude -f install build-essential
sudo apt-get install ia32-libs
) and the output from that command. Also, doessudo apt-get dist-upgrade
show any available updates? – thomasrutter Nov 29 '12 at 1:59