0

build-essential installation is failing on freshly installed Ubuntu 18.10 with this error:

$ sudo apt 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:7.3) but it is not going to be installed
                   Depends: g++ (>= 4:7.3) but it is not going to be installed
                   Depends: dpkg-dev (>= 1.17.11) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Installation via deb file is also failing.

I think this package is not correctly ported to 18.10 because its asking for outdated dependencies (dependencies versions available in 18.04 LTS). What is the safest way to install it?

Note that I have already installed it (on some other machine) with unsafe methods e.g. downgrading packages via aptitude but this method breaks too many other packages.

Update #1:

libc6-dev installation is failing.

$ sudo apt 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.27-3ubuntu1) but 2.28-0ubuntu1 is to be installed
             Depends: libc-dev-bin (= 2.27-3ubuntu1)
E: Unable to correct problems, you have held broken packages.

I don't know why apt is looking for older versions of libc6 and libc-dev-bin.

Similarly, apt shows that gcc also depends on previous version of cpp.

$ sudo apt install gcc
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:
 gcc : Depends: cpp (= 4:8.1.0-2ubuntu1) but 4:8.2.0-1ubuntu1 is to be installed
       Depends: gcc-8 (>= 8.1.0-4~) but it is not going to be installed
       Recommends: libc6-dev but it is not going to be installed or
                   libc-dev
E: Unable to correct problems, you have held broken packages.

Update #2: apt-cache policy output

$ apt-cache policy gcc cpp
gcc:
  Installed: (none)
  Candidate: 4:8.1.0-2ubuntu1
  Version table:
     4:8.1.0-2ubuntu1 500
        500 http://pk.archive.ubuntu.com/ubuntu cosmic/main amd64 Packages
cpp:
  Installed: 4:8.2.0-1ubuntu1
  Candidate: 4:8.2.0-1ubuntu1
  Version table:
 *** 4:8.2.0-1ubuntu1 100
        100 /var/lib/dpkg/status
     4:8.1.0-2ubuntu1 500
        500 http://pk.archive.ubuntu.com/ubuntu cosmic/main amd64 Packages
  • I would suggest checking your sources. Yes the deps mentioned look correct as far as I looked (packages.ubuntu.com/cosmic/build-essential), but they are available for cosmic (packages.ubuntu.com/cosmic/gcc) that meet those standards, so I'd correct your held broken packages problem first, then check your sources. – guiverc Feb 9 at 8:25
  • @guiverc I have also added installation logs of gcc and libc6-dev that clearly shows outdated dependencies issue. I currently don't have any held package. output of apt-mark showhold shows nothing – Abdul Rauf Feb 9 at 9:04
  • You can try sudo apt autoremove before you install build-essential and gcc. – Felix Solomon Feb 9 at 9:06
  • @FelixSolomon autoremove is not currently showing any orphaned dependencies to remove – Abdul Rauf Feb 9 at 9:09
  • 1
    Can you please add apt-cache policy gcc cpp ; though I'm suspicious you are using a mirror that is badly out of date, eg. if you check launchpad.net/ubuntu/+archivemirrors I'm suspicious you're chosen mirror will have last update unknown thus your package woes, (in which case changing to a maintained mirror is your fix if my guess is accurate, checking this may be best done first) – guiverc Feb 9 at 9:30
3

I suspected (now proven) you were using a mirror that was badly out of date, eg. if you checked https://launchpad.net/ubuntu/+archivemirrors I believed your chosen mirror would have listed last update unknown (counter overflowed as too long ago) thus your package woes.

I suspected this as your results didn't match up with expected packages on https://packages.ubuntu.com/

The fix is to switch to a maintained mirror (from aforementioned list) or the main archive.

1

I was using outdated pk.archive.ubuntu.com archive mirror provided by Nayatel

$ ping pk.archive.ubuntu.com
PING mirrors.nayatel.com (115.186.188.244) 56(84) bytes of data.
64 bytes from mirrors.nayatel.com (115.186.188.244): icmp_seq=1 ttl=56 time=65.9 ms

enter image description here

Issue resolved after switching to Official Main server. Thanks @guiverc for indicating this issue.

Update: I emailed this issue to mirrors@ubuntu.com and they disabled it because it wasn't following country mirror requirements

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.