0

I am trying to install build-essential package on Ubuntu 16.04 (Xenial Xerus) but there is a dependency issue.

root@server:~# apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed or
                            libc-dev
                   Depends: gcc (>= 4:5.2) but it is not going to be installed
                   Depends: g++ (>= 4:5.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

and when I tried,

root@server:~# apt-get install libc6-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.23-0ubuntu2) but 2.23-0ubuntu3 is to be installed
E: Unable to correct problems, you have held broken packages.

and also;

root@server:~# apt-cache policy libc6-dev
libc6-dev:
  Installed: (none)
  Candidate: 2.23-0ubuntu2
  Version table:
     2.23-0ubuntu2 500
        500 http://tr.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

root@server:~# apt-cache policy gcc
gcc:
  Installed: (none)
  Candidate: 4:5.3.1-1ubuntu1
  Version table:
     4:5.3.1-1ubuntu1 500
        500 http://tr.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

root@server:~# apt-cache policy g++
g++:
  Installed: (none)
  Candidate: 4:5.3.1-1ubuntu1
  Version table:
     4:5.3.1-1ubuntu1 500
        500 http://tr.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
4
  • Did you try the solutions askubuntu.com/questions/223237/…
    – Ron
    Apr 22, 2016 at 15:48
  • @Ron yea, I tried but no luck. I reinstalled the os, but this time installed the build-essential first, now it working without problem.
    – ecabuk
    Apr 23, 2016 at 15:53
  • Looks like some package indices are simply out of date. Run sudo apt-get update and try again. If that produces and error or the problem persists, report back. Apr 24, 2016 at 12:25
  • 1
    I experienced the same problem with the repositories in Thailand. The problem has been solved by changing the repo back to the main Ubuntu repository. Apr 28, 2016 at 9:58

2 Answers 2

3

Turkish repo have some problems. You can change /etc/apt/sources.list file.

replace all lines http://tr.archive.ubuntu.com/ubuntu to http://archive.ubuntu.com/ubuntu

and execute sudo apt-get update; sudo apt-get upgrade

1

libc6-dev : Depends: libc6 (= 2.23-0ubuntu2) but 2.23-0ubuntu3 is to be installed

libc6 and libc6-dev need to be the same version but the version of libc6-dev found on the mirrors apt is set up to use is older than the version of libc6 on your system and apt wont normally downgrade packages.

In this case it looks like your issue is a badly outdated mirror (2.23-0ubuntu3 has been in xenial for over a week now). I would suggest changing your sources.list to point at a different mirror.

You can also run into this issue when someone changes the sources.list to a newer release, installs some stuff and changes it back but in that case you would usually see a larger version difference.

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