This is a small guide on resolving an issue I was having that prevented me from installing libc6-dev
. The issue I was having was as such:
libc6-dev : Depends: libc6 (= 2.35-0ubuntu3) but 2.35-0ubuntu3.1 is to be installed
The libc6-dev
package wants to install version 2.35-0ubuntu3
, which is (very slightly) "older" than the libc6
package I have installed at version 2.35-0ubuntu3.1
(notice the .1
). This basically prevents me from installing libc6-dev
which in turn prevents me from installing build-essential
. You need build-essential
to do a lot of development work, such as compiling C code.
Here is the process I went through, from discovering the problem to solving it, but let's start with the solution straight up.
For me, it was enough to force the install of the (slightly) "older" version of libc6
, as everything else is essentially pinned to that package (libc
is actually kind of a big deal in the UNIX world.):
sudo apt install -f libc6=2.35-0ubuntu3 libc6:i386=2.35-0ubuntu3
This will reduce libc6
(which is the 64-bit version) and libc6:i386
(the 32-bit equivalent) down to version 2.35-0ubuntu3
(notice the lack of .1
on the end, now.) This meant I could install what I needed now:
sudo apt install build-essential
Which install libc6-dev
successfully.
Here's the journey I went through in a bit more detail.
$ sudo apt install build-essential
...
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:
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.
Which means build-essential
requires libc6-dev
, so you try this:
$ sudo apt install libc6-dev
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.
This means libc6-dev
version 2.35-0ubuntu3
cannot be installed against the libc6 version 2.35-0ubuntu3.1
you have installed, and apt won't downgrade the package. To resolve this, you must forcefully downgrade the libc6
package, like this:
$ sudo apt install -f libc6=2.35-0ubuntu3 libc6:i386=2.35-0ubuntu3
...
The following packages will be REMOVED:
libc6-dbg
The following packages will be DOWNGRADED:
libc6 libc6:i386
0 to upgrade, 0 to newly install, 2 to downgrade, 1 to remove and 0 not to upgrade.
Notice how libc6:i386
will also need to be downgraded? That's because it's the 32-bit version of the libc6
package and they both must be in sync. Now we install libc6-dev
as the versions will match:
$ sudo apt install libc6-dev
...
The following additional packages will be installed:
libc-dev-bin libc-devtools libcrypt-dev libnsl-dev libtirpc-dev linux-libc-dev manpages-dev rpcsvc-proto
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-dev-bin libc-devtools libc6-dev libcrypt-dev libnsl-dev libtirpc-dev linux-libc-dev manpages-dev rpcsvc-proto
0 to upgrade, 9 to newly install, 0 to remove and 0 not to upgrade.
And you should be OK. Now you might be thinking, "What if I now do an apt upgrade
- won't I get that newer libc6
and libc6-dev
setup I originally had (minus libc6-dev
)?" No:
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
But now you can circle back around and finally install build-essential
:
$ sudo apt install build-essential
...
The following additional packages will be installed:
dpkg-dev fakeroot g++ g++-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot libstdc++-11-dev lto-disabled-list
Suggested packages:
debian-keyring g++-multilib g++-11-multilib gcc-11-doc libstdc++-11-doc
The following NEW packages will be installed:
build-essential dpkg-dev fakeroot g++ g++-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot libstdc++-11-dev lto-disabled-list
0 to upgrade, 11 to newly install, 0 to remove and 0 not to upgrade.
This resolved the libc6
and libc6-dev
package issue on my Ubuntu 22.04 installation.
sudo apt install build-essential
Which install libc6-dev
successfully.
Here's the journey I went through in a bit more detail.
$ sudo apt install build-essential
...
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:
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.
Which means build-essential
requires libc6-dev
, so you try this:
$ sudo apt install libc6-dev
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.
This means libc6-dev
version 2.35-0ubuntu3
cannot be installed against the libc6 version 2.35-0ubuntu3.1
you have installed, and apt won't downgrade the package. To resolve this, you must forcefully downgrade the libc6
package, like this:
$ sudo apt install -f libc6=2.35-0ubuntu3 libc6:i386=2.35-0ubuntu3
...
The following packages will be REMOVED:
libc6-dbg
The following packages will be DOWNGRADED:
libc6 libc6:i386
0 to upgrade, 0 to newly install, 2 to downgrade, 1 to remove and 0 not to upgrade.
Notice how libc6:i386
will also need to be downgraded? That's because it's the 32-bit version of the libc6
package and they both must be in sync. Now we install libc6-dev
as the versions will match:
$ sudo apt install libc6-dev
...
The following additional packages will be installed:
libc-dev-bin libc-devtools libcrypt-dev libnsl-dev libtirpc-dev linux-libc-dev manpages-dev rpcsvc-proto
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-dev-bin libc-devtools libc6-dev libcrypt-dev libnsl-dev libtirpc-dev linux-libc-dev manpages-dev rpcsvc-proto
0 to upgrade, 9 to newly install, 0 to remove and 0 not to upgrade.
And you should be OK. Now you might be thinking, "What if I now do an apt upgrade
- won't I get that newer libc6
and libc6-dev
setup I originally had (minus libc6-dev
)?" No:
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
But now you can circle back around and finally install build-essential
:
$ sudo apt install build-essential
...
The following additional packages will be installed:
dpkg-dev fakeroot g++ g++-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot libstdc++-11-dev lto-disabled-list
Suggested packages:
debian-keyring g++-multilib g++-11-multilib gcc-11-doc libstdc++-11-doc
The following NEW packages will be installed:
build-essential dpkg-dev fakeroot g++ g++-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot libstdc++-11-dev lto-disabled-list
0 to upgrade, 11 to newly install, 0 to remove and 0 not to upgrade.
This resolved the libc6
and libc6-dev
package issue on my Ubuntu 22.04 installation.
I'm using Armbian which is Jammy based. This is using a BananaPi that is only a ARM based platform.
My fix was:
My error I had: