sudo apt-get install g++ FAILS ... don't know what to do

uy flag

I'm trying to install the g++ compiler on Ubuntu 22.04.1 LTS, and I get the following:

$ sudo apt-get install g++

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 resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.35-0ubuntu3) but 2.35-0ubuntu3.1 is to be installed
E: Unable to correct problems, you have held broken packages.


$ dpkg --get-selections | grep hold

returns me nothing at all. I am new to Linux, so I have no idea what to do next.

Does anyone know how to resolve this issue?

Regards, -- DrB.

UPDATE 1: I tried

$ sudo apt install build-essential

but that gave me the exact same result.

UPDATE 2: I downgraded libc6 as follows:

$ sudo apt install libc6=2.35-0ubuntu3 libc-bin=2.35-0ubuntu3

after that, the command

$ sudo apt-get install g++

worked just fine.


The question now is... how can I find out what else I broke by doing this?

DrB avatar
uy flag
Nope. Tried all that. That's a 10-year-old thread, by the way. (why can't I insert newlines into this comment?) The issue is that g++ depends on libc6 v.3, but v3.1 is already installed, and I assume it's installed for a reason, so I don't want to mess with it unless someone can verify that it won't break anything if I do...
karel avatar
sa flag
1. To answer your new question from the latest edit at the end of your question please install the notepadqq snap package using `sudo snap install notepadqq` It works OK. 2. Please refer to [How to prevent updating of a specific package?](
I sit in a Tesla and translated this thread with Ai:


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.