Cannot install build-essential on fresh Ubuntu 20.04.2 installation

Bug #1920753 reported by Tigran Aivazian
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubiquity (Ubuntu)
Expired
Low
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...

Revision history for this message
Jani Uusitalo (uusijani) wrote :

Just got hit by the same issue in a VM after a fresh install of 20.04.5. I chose "Minimal installation", ticked "Download updates while installing", and installed the remaining updates post-install.

After that the first thing I tried to do was to install build-essential, which failed, because the version of libc6 was out of sync with the rest of the libc6* packages: libc6 was already at 2.31-0ubuntu9.9, while e.g. libc6-dev was still only available as 2.31-0ubuntu9.7.

I tried switching from my local archive (fi.archive.ubuntu.com) to the main one (archive.ubuntu.com), but that made no difference. I had to downgrade libc6 to 2.31-0ubuntu9.7 to be able to install build-essential.

Benjamin Drung (bdrung)
tags: added: foundations-triage-discuss
Revision history for this message
Simon Chopin (schopin) wrote :

@Jani: on the affected system, could you give us the output of `apt policy libc6-dev` and apt policy libc6` ?

My guess would be that it's due to phased updates, but I don't get why 2.31_0ubuntu9.7 would still be held back?

Revision history for this message
Jani Uusitalo (uusijani) wrote :

@Simon Here goes, although now it just shows both at 9.7, and 9.9 not yet available. Before I downgraded libc6 it obviously showed libc6 at 9.9.

I also tried to reproduce the issue in a fresh VM, but those kept getting 9.9 for all the packages, so installing build-essential caused no issues.

I don't have in-depth knowledge about phased updates, but this looked like as if downloading the updates during installation was not yet affected by phased updates (and hence got libc 9.9), but, after the installation was completed, the system got cast into a "still at 9.7" group of phased updates, and so libc6-dev (et al) could not be installed.

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

apt in focal does not use phased-updates.

 libc6-dev | 2.31-0ubuntu9.7 | focal-security | amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
 libc6-dev | 2.31-0ubuntu9.9 | focal-updates | amd64, arm64, armhf, i386, ppc64el, riscv64, s390x

This looks like you do not have the updates pocket enabled in your apt sources, despite it being enabled by default. Did you consciously disable it?

Revision history for this message
Jani Uusitalo (uusijani) wrote :

@Steve I did not.

Revision history for this message
Jani Uusitalo (uusijani) wrote :

Looks like the deb line for updates is missing entirely from sources.list in this install; only the deb-src is there.

Revision history for this message
Olivier Gayot (ogayot) wrote :

I just tried an install of 20.04.5 in a VM after selecting:
* Minimal installation
* Download updates while installing.
* Erase disk and install Ubuntu

Sadly, I did not reproduce the issue. After reboot, I was able to install build-essential and my source.list contains the -updates pocket as expected.

$ grep -v '^#' sources.list | awk NF

deb http://fr.archive.ubuntu.com/ubuntu/ focal main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ focal universe
deb http://fr.archive.ubuntu.com/ubuntu/ focal-updates universe
deb http://fr.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse

Full source list content: https://pastebin.canonical.com/p/Bs945Z8FQV/

@uusijani, would you mind sharing the output of /var/log/installer from your broken installation? There might be information in this file that you could consider confidential, so please make sure to redact anything sensitive.

Revision history for this message
Jani Uusitalo (uusijani) wrote :

@Olivier: Sure. This VM was just for testing purposes, so there shouldn't be anything confidential here.

Revision history for this message
Julian Andres Klode (juliank) wrote :

You have installed from a point release media which incldues the -updates pocket, but the machine now only has the -security pocket enabled so it can only find older versions of the packages. This is a local configuration issue, not a bug in the software. Unless software removed the entries, but that seems unlikely. Maybe you clicked somewhere wrong by accident?

Changed in build-essential (Ubuntu):
status: New → Invalid
Revision history for this message
Brian Murray (brian-murray) wrote :

It looks like the -updates pocket was disabled during the installation process (or there was a failure writing to /etc/apt/sources.list) during the installation process. However, there will be no further installation images of Ubuntu 20.04 created. Subsequently, it would be good to test this with Ubuntu 22.04 which will receive more installation images.

affects: build-essential (Ubuntu) → ubiquity (Ubuntu)
Changed in ubiquity (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
Jani Uusitalo (uusijani) wrote :

@Julian: I'd argue that if a simple accidental click somewhere can cause this, that's a loaded gun pointed at the user's toe, and hence a bug in the installer.

@Brian: I'll try the 22.04 images. I've kept trying with 20.04.5, but have yet to find another instance of this occurring, so it's obviously not easy to trigger.

I'm not particularly troubled by this issue (and the original reporter doesn't seem to be either), so feel free to adjust 'Importance' accordingly.

Changed in ubiquity (Ubuntu):
importance: Undecided → Low
tags: removed: foundations-triage-discuss
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for ubiquity (Ubuntu) because there has been no activity for 60 days.]

Changed in ubiquity (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.