Cannot install build-essential on fresh Ubuntu 20.04.2 installation

Bug #1920753 reported by Tigran Aivazian
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
build-essential (Ubuntu)
Undecided
Unassigned

Bug Description

After a fresh install of Ubuntu 20.04.2 (followed by upgrade to the very latest packages) I installed gcc and then wanted to install build-essential, but it fails with the following error message:

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

This means that nothing can be compiled, obviously.

Also, g++ cannot be installed either:

$ sudo apt install g++
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.
 g++ : Depends: g++-9 (>= 9.3.0-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Revision history for this message
Chris Guiver (guiverc) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Bug reporting is mostly about finding & fixing problems thus preventing future users from hitting the same bug.

I suspect a Support site would be more appropriate, eg. https://answers.launchpad.net/ubuntu. You can also find help with your problem in the support forum of your local Ubuntu community http://loco.ubuntu.com/ or asking at https://askubuntu.com or https://ubuntuforums.org, or for more support options please look at https://discourse.ubuntu.com/t/community-support/709

I've marked this as incomplete, as it looks like you need support (no indication that you've update your software lists since installation was provided, held-broken packages that requires fixing), etc. If you believe I'm in error, please leave a comment as to why, and change the status back to "New". The package will need correction, then you'll be requested to run `apport-collect`

Changed in ubuntu:
status: New → Incomplete
Revision history for this message
Chris Guiver (guiverc) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please execute the following command only once, as it will automatically gather debugging information, in a terminal:

apport-collect 1920753

When reporting bugs in the future please use apport by using 'ubuntu-bug' and the name of the package affected. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

affects: ubuntu → build-essential (Ubuntu)
Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

I have indicated in the bug report that I have done "sudo apt update ; sudo apt upgrade", so, yes the package lists have been updated, of course.

Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

And yes, I have executed the "apport-collect 1920753" as you suggested.

Changed in build-essential (Ubuntu):
status: Incomplete → New
Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

Also, I confirm that there are no held packages, i.e. dpkg --get-selections | grep hold shows nothing.

Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

Just wanted to add that it is not just build-essential, but lots of other packages required for development that cannot be installed, e.g. this:

 sudo apt-get install libwxbase3.0-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.
 libwxbase3.0-dev : Depends: libc6-dev but it is not going to be installed or
                             libc-dev
E: Unable to correct problems, you have held broken packages.

Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

Oh, I have some good news. I just couldn't believe that Ubuntu 20 is so badly broken that it is impossible to compile anything (surely, it would be noticed by someone!) so I installed it in a VM inside the VirtualBox and "build-essential" was installable without any problems (and gcc compiles programs just fine).

Now, the only difference between this install and the one I did in the morning on the physical SSD is that in the morning I ticked the option "Download upgrades while installing" (or left it checked). In the VM I unchecked this box. And also, in the fresh install in the VM I installed "build-essentials" WITHOUT doing "sudo apt update ; sudo apt upgrade".

So, my guess is that one or both of these two things cause build-essential breakage:

1. Ticking "Download upgrades during installation" option during install.
2. Doing "sudo apt update ; sudo apt upgrade" BEFORE "sudo apt install build-essential"

Revision history for this message
Steve Langasek (vorlon) wrote :

When this problem is reproduced, what version of gcc is installed and what does 'apt policy g++' show?

Changed in build-essential (Ubuntu):
status: New → Incomplete
Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

The version of gcc has been indicated in the initial bug report, please read it.
The output of 'apt policy g++' will be produced when I boot into that installation.

Revision history for this message
Steve Langasek (vorlon) wrote :

You showed the output of 'gcc --version' which is but what I'm asking for, I'm asking for the version down in 'dpkg -l gcc' which is different.

Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

Ok, here is all the information you requested:

$ dpkg -l gcc
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-================-============-=================================
ii gcc 4:9.3.0-1ubuntu2 amd64 GNU C compiler
$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ apt policy g++
g++:
  Installed: (none)
  Candidate: 4:9.3.0-1ubuntu2
  Version table:
     4:9.3.0-1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

Changed in build-essential (Ubuntu):
status: Incomplete → New
Revision history for this message
Steve Langasek (vorlon) wrote :

ok, that doesn't show anything that would explain the incompatibility. How about apt policy g++-9?

Revision history for this message
Tigran Aivazian (aivazian-tigran) wrote :

I have just now re-installed the system while unticking the option "Download upgrades while installing" during the installation. And then proceeded to do "sudo apt install build-essential gcc g++" and it worked just fine. Then I did "sudo apt update ; sudo apt upgrade" and everything is working fine now.

So, it remains a mystery why it was possible to do a simple complete install resulting in build-essential not installable.

Since I can't reproduce this anymore (I am not going to reinstall with the option "Download updates while installing") you can close the issue, if you wish. Or try reproducing it, but then "Download updates while installing" obviously depends on time, so whatever it was causing a few days ago it may or may not cause again...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions