Score:0

sudo apt install build-essential error on ubuntu 22.04

in flag
$ sudo apt install build-essential
Reading package lists... Done
Building dependency tree... Done
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: cpp (= 4:9.3.0-1ubuntu2) but 4:11.2.0-1ubuntu1 is to be installed
 gcc : Depends: cpp (= 4:9.3.0-1ubuntu2) but 4:11.2.0-1ubuntu1 is to be installed
 libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.9) but 2.35-0ubuntu3.1 is to be installed
             Depends: libc-dev-bin (= 2.31-0ubuntu9.9)
             Depends: libcrypt-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Organic Marble avatar
us flag
It appears that you are trying to install packages that are not from the basic repositories. Please add the output of `apt policy build-essential` to your question and disclose any ppas that you have added to your system.
lakshman avatar
in flag
no happened only the output sudo apt policy build-essential build-essential: Installed: (none) Candidate: 12.8ubuntu1.1 Version table: 12.8ubuntu1.1 500 500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages 12.8ubuntu1 500 500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
hr flag
@lakshman please [edit] that information into your question
Score:2
us flag

Per request you provided the output of apt policy build-essential as follows:

Installed: (none) 
Candidate: 12.8ubuntu1.1 
Version table: 
    12.8ubuntu1.1 500 500 archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages 
    12.8ubuntu1 500 500 archive.ubuntu.com/ubuntu focal/main amd64 Packages

The obvious problem here is that you are running 22.04 (jammy) and you are using 20.04 (focal) sources.

The proper output for this package in 22.04 looks like this

  Installed: 12.9ubuntu3
  Candidate: 12.9ubuntu3
  Version table:
 *** 12.9ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

The fix is to correct /etc/apt/sources.list

us flag
Also please post a link about how to correct sources.list
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.