even after cleaning with apt-get clean
it says there are broken packages. sudo dpkg -l | grep ^..r
as mentioned in [1] returns nothing.
$ sudo 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: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
[1] https://www.techbrown.com/fix-broken-packages-ubuntu-debian/
5
Answers
After looking for an answer, I figured to manually install the "correct" version manually, and came across this when downloading the pkg file:
Add the following line to /etc/apt/sources.list:
Update the package index:
After adding this repository, I was able to install build-essential with the command:
TL;DR: had to downgrade
libc6
and then was able to installbuild-essential
Experienced the same thing:
Here’s what I did to fix it.
Checked
apt-cache policy g++
, I thought this was already satisfied so I moved on:Checked
apt-cache policy libc6-dev
:Tried to install a specific version (the latest shown above):
Did the same thing, tried to install that specific
libc6
version:Emphasis on the warning I got:
dpkg: warning: downgrading libc6:amd64 from 2.31-0ubuntu9.3 to 2.31-0ubuntu9.2
Now I was able to install
build-essential
:I read multiple different stackoverflow posts that led me to use the
apt-cache policy $package
that I was not familiar with. Then I just played around.I suppose I found a super simple solution by chance. No downgrade or kernel builds. Just ran
There were 3 repositories returning errors in my case. Such as,
Just launched software updater, removed PPAs with errors, now I’m able to install new software without getting
error.
You have to apply for support of ‘Canonical Partners’ from Software & Updates.
Software & Updates of Ubuntu20
Mark ‘tick’ in Canonical Partners (not the source code one) and then do
I had a similar problem in
Ubuntu 22.04 LTS
While I was usingsudo apt install build-essential
,error:
solution:
I tried to down-grade the package with command
However, it did not solve the problem, and lead to the last error:
Solution:
So, I again downgraded the error package
Now, finally the problem gone and I can use