7

A gcc compiler was misbehaving, and in the process of fixing it part of the libc6 package was uninstalled. Now I am trying to reinstall it using apt-get on Ubuntu 14.04 (3.13.0-24-generic). However, sudo apt-get install libc6-dev gives the following error message:

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

I have tried using aptitude install, uninstalling various packages, and basically every variant of the command I can think of. However, they all give a variant of this error. How can I fix this, or at least work around this to install gcc and gfortran?

Edit:

Here is the output of apt-cache policy libc6 libc6-dev:

libc6:
  Installed: 2.19-10ubuntu2.1
  Candidate: 2.19-10ubuntu2.1
  Version table:
 *** 2.19-10ubuntu2.1 0
        100 /var/lib/dpkg/status
     2.19-10ubuntu2 0
        500 http://old-releases.ubuntu.com/ubuntu/ utopic/main amd64 Packages

libc6-dev:
  Installed: (none)
  Candidate: 2.19-10ubuntu2
  Version table:
     2.19-10ubuntu2 0
        500 http://old-releases.ubuntu.com/ubuntu/ utopic/main amd64 Packages

The output of cat /etc/os-release is:

NAME="Ubuntu" VERSION="14.10 (Utopic Unicorn)" ID=ubuntu
ID_LIKE=debian PRETTY_NAME="Ubuntu 14.10" VERSION_ID="14.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

and grep utopic -ir /etc/apt/sources.list /etc/apt/sources.list.d/*.list gives:

/etc/apt/sources.list:deb http://old-releases.ubuntu.com/ubuntu utopic
main universe restricted multiverse /etc/apt/sources.list:deb-src
http://old-releases.ubuntu.com/ubuntu utopic main universe restricted
multiverse #Added by software-properties /etc/apt/sources.list:# deb
http://old-releases.ubuntu.com/ubuntu/ utopic-security main universe
restricted multiverse /etc/apt/sources.list:deb-src
http://old-releases.ubuntu.com/ubuntu/ utopic-security main universe
restricted multiverse #Added by software-properties
/etc/apt/sources.list:# deb http://old-releases.ubuntu.com/ubuntu
utopic-updates main universe restricted multiverse
/etc/apt/sources.list:deb-src http://old-releases.ubuntu.com/ubuntu
utopic-updates main universe restricted multiverse #Added by
software-properties
/etc/apt/sources.list.d/george-edison55-ubuntu-cmake-3_x-utopic.list:deb
http://ppa.launchpad.net/george-edison55/cmake-3.x/ubuntu utopic main
/etc/apt/sources.list.d/george-edison55-ubuntu-cmake-3_x-utopic.list:#
deb-src http://ppa.launchpad.net/george-edison55/cmake-3.x/ubuntu
utopic main
/etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-utopic.list:deb
http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu utopic main
/etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-utopic.list:#
deb-src http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu utopic
main
/etc/apt/sources.list.d/gwendal-lebihan-dev-cinnamon-nightly-utopic.list:deb
http://ppa.launchpad.net/gwendal-lebihan-dev/cinnamon-nightly/ubuntu
utopic main
/etc/apt/sources.list.d/gwendal-lebihan-dev-cinnamon-nightly-utopic.list:#
deb-src
http://ppa.launchpad.net/gwendal-lebihan-dev/cinnamon-nightly/ubuntu
utopic main
/etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-utopic.list:deb
http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu utopic main
/etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-utopic.list:#
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu utopic
main
/etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-utopic.list:#
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu utopic
main

When I try sudo apt-get install --reinstall libc6, I get the following message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of libc6 is not possible, it cannot be downloaded.
The following packages will be REMOVED:
  nvidia-331-updates
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 184 MB disk space will be freed.
Do you want to continue? [Y/n]

Here is the output of sudo apt-get install libc6=2.19-10ubuntu2

The following packages will be REMOVED:
  lib32gcc1 lib32z1 libc6:i386 libc6-i386 libgcc1:i386 nvidia-331-updates
  retty:i386
The following packages will be DOWNGRADED:
  libc6
0 upgraded, 0 newly installed, 1 downgraded, 7 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 4,765 kB of archives.
After this operation, 204 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://old-releases.ubuntu.com/ubuntu/ utopic/main libc6 amd64 2.19-10ubuntu2 [4,765 kB]
Fetched 4,765 kB in 0s (5,794 kB/s)
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

Here are the error messages that appear after sudo apt-get update:

W: Failed to fetch http://ppa.launchpad.net/gwendal-lebihan-dev/cinnamon-nightly/ubuntu/dists/utopic/InRelease  Unable to find expected entry 'main/binary-foreign-architecture/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/utopic/InRelease  Unable to find expected entry 'main/binary-foreign-architecture/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://ppa.launchpad.net/george-edison55/cmake-3.x/ubuntu/dists/utopic/Release  Unable to find expected entry 'main/binary-foreign-architecture/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/dists/utopic/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/dists/utopic/main/binary-foreign-architecture/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/dists/utopic/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/utopic/Release  Unable to find expected entry 'main/binary-foreign-architecture/Packages' in Release file (Wrong sources.list entry or malformed file)

Here is the output of ls -la /lib/x86_64-linux-gnu/libc*:

-rwxr-xr-x 1 root root 1844160 Dec  1  2014 /lib/x86_64-linux-gnu/libc-2.19.so
lrwxrwxrwx 1 root root      14 Feb 21  2014 /lib/x86_64-linux-gnu/libcap.so.2 -> libcap.so.2.24
-rw-r--r-- 1 root root   18952 Feb 21  2014 /lib/x86_64-linux-gnu/libcap.so.2.24
lrwxrwxrwx 1 root root      21 Dec 15  2014 /lib/x86_64-linux-gnu/libcgmanager.so.0 -> libcgmanager.so.0.0.0
-rw-r--r-- 1 root root  133056 Dec 15  2014 /lib/x86_64-linux-gnu/libcgmanager.so.0.0.0
-rw-r--r-- 1 root root  194968 Dec  1  2014 /lib/x86_64-linux-gnu/libcidn-2.19.so
lrwxrwxrwx 1 root root      15 Dec  1  2014 /lib/x86_64-linux-gnu/libcidn.so.1 -> libcidn-2.19.so
lrwxrwxrwx 1 root root      17 Jul  7  2014 /lib/x86_64-linux-gnu/libcom_err.so.2 -> libcom_err.so.2.1
-rw-r--r-- 1 root root   14592 Jul  7  2014 /lib/x86_64-linux-gnu/libcom_err.so.2.1
-rw-r--r-- 1 root root   43368 Dec  1  2014 /lib/x86_64-linux-gnu/libcrypt-2.19.so
-rw-r--r-- 1 root root 1961344 Jan  9  2015 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
lrwxrwxrwx 1 root root      16 Dec  1  2014 /lib/x86_64-linux-gnu/libcrypt.so.1 -> libcrypt-2.19.so
lrwxrwxrwx 1 root root      12 Dec  1  2014 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.19.so
JAustin
  • 123
  • Please [edit] your question to include the output of apt-cache policy libc6 libc6-dev – steeldriver Jul 16 '18 at 20:35
  • Done. Let me know if there's any other information I can add. – JAustin Jul 17 '18 at 04:31
  • 1
    Looks very strange. Why do you have mentions of utopic if you are running 14.04 LTS (trusty tahr)? Please add output of cat /etc/os-release and grep utopic -ir /etc/apt/sources.list /etc/apt/sources.list.d/*.list to the question. – N0rbert Jul 17 '18 at 10:28
  • 1
    I am now very confused too. The kernel version is 3.13.0-24-generic (i.e. 14.04), but cat /etc/os-release shows that it is running 14.10. – JAustin Jul 17 '18 at 17:38
  • Can you post the result of sudo apt-get install libc6=2.19-10ubuntu2? I updated my answer... – Olimjon Jul 25 '18 at 13:41
  • dpkg: error: 1 expected program not found in PATH or not executable this happens if you mess with the libc. Almost all programms use the libc.so.6 as shared library. Please add the output of: ls -la /lib/x86_64-linux-gnu/libc* to your question – Simon Sudler Jul 25 '18 at 14:04
  • You needed the 2.1 version which isn't in the old repo. Get it from here and install with dpkg. https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/6608877 – doug Jul 25 '18 at 14:23
  • OK, I cleaned the mess with my answer. That will surely solve your problem. – Olimjon Jul 25 '18 at 17:41

3 Answers3

3

OK, let's start everything from scratch:

You can do what recommends user @doug to solve your problem:

wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/6608877/+files/libc6-dev_2.19-10ubuntu2.1_amd64.deb
sudo dpkg -i libc6-dev_2.19-10ubuntu2.1_amd64.deb

If this works, you can upvote this answer, however, do not accept this. Wait until the original author posts the answer, then accept it.

But, keep in mind that by using this method you are only bypassing the real problem. You cannot update your repository, add PPAs or in worst case if something happens with your package cache, install other programs. So, I recommend you to use this method if nothing else helps.

In case if you truly want to cleanly solve the problem, then:

Step 1: Start cleaning the mess with sources.list:

Run the following command to remove PPAs other than official Ubuntu repository, as they became obsolete:

sudo rm /etc/apt/sources.list.d/*.list

Then backup, open and edit the sources.list:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
sudo gedit /etc/apt/sources.list

Remove everything from there and add these lines:

deb http://old-releases.ubuntu.com/ubuntu utopic main universe restricted multiverse
deb http://old-releases.ubuntu.com/ubuntu/ utopic-security main universe restricted multiverse
deb http://old-releases.ubuntu.com/ubuntu utopic-updates main universe restricted multiverse

Save and exit.

Step 2: Update the repository:

Run the following command:

sudo apt-get update

Ensure that this command works flawlessly. In case of GPG error happens, add keys and update your repository again:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192

Step 3: Fix ldconfig:

Run the following commands:

wget http://launchpadlibrarian.net/172657659/libc-bin_2.19-0ubuntu6_amd64.deb
dpkg -x libc-bin*.deb libdir/
sudo cp libdir/sbin/ldconfig /sbin/
sudo dpkg -i libc-bin*.deb
sudo apt-get install -f

Partly taken from here.

Step 4: Install:

Run the following commands:

sudo apt-get install libc6=2.19-10ubuntu2
sudo apt-get install libc6-dev

Hope this helps...

Olimjon
  • 7,292
  • Don't do that! If you remove the glibc from a running system, you will break it. apt-get will stop working while removing the glibc. – Simon Sudler Jul 25 '18 at 08:42
  • @Simon Sudler, thanks. I edited the answer. I had no idea of libc6 was such an important package – Olimjon Jul 25 '18 at 08:47
  • It will still break the system. Try removing the libc6 in a docker container and watch the fallout. There is also a message from apt-get: WARNING: The following essential packages will be removed. – Simon Sudler Jul 25 '18 at 08:53
  • @Simon Sudler, well, it worked for me without any removals on my own system Ubuntu 18.04. If you want I will include this as a proof. – Olimjon Jul 25 '18 at 08:57
  • No, this is not a docker question, but if you want to test who to destroy your base system, docker contains are a save way to do it. Anyway, the reinstall will not fix the broken dependeny issue with the libc6-dev. It can be solved my manuall install the packages with dpkg -i -f. But before that, the apt sources must be fixed... and I am not willing to write a two page answer ;-) – Simon Sudler Jul 25 '18 at 10:43
  • When I try to reinstall libc6 using apt-get, I get a very unhelpful error message (I've edited the original post with it). I'm not sure how to proceed. It seems the installation has been more or less broken - is there any way I can upgrade the distribution or reset it without losing installed libraries? – JAustin Jul 25 '18 at 13:22
  • I updated my post with the response. This seems hopelessly messed up. I also included the output of apt-get update. – JAustin Jul 25 '18 at 13:57
  • I added the output. – JAustin Jul 25 '18 at 14:07
  • This is actually very promising. However, when I run sudo apt-get download libc-bin, it says it Can't select candidate version from package libc-bin as it has no candidate. Right now nothing is checked in the software-properties-gtk GUI pop-up. Should I select something and/or reload it? – JAustin Jul 25 '18 at 15:50
  • Too convoluted, just get the proper deb package – doug Jul 25 '18 at 16:54
  • Thank you very much. The first method didn't work because some of the paths dpkg uses were damaged, but following the later instructions worked perfect. Thank you all very much for everything. Couldn't have figured that out without your help. – JAustin Jul 25 '18 at 18:39
  • @JAustin, you are welcome. However, I recommend you to cleanly install Ubuntu 18.04 LTS, as there could be unforeseen consequences if you continue using this mix of 14.04 and 14.10. – Olimjon Jul 26 '18 at 00:54
0

I was trying to run mozilla's deepspeech example ffmpeg_vad_streaming on clean Ubuntu 22.04.1 LTS when I encountered a similar error as in the question.

First I had an error while installing node packages:

npm ERR! /usr/lib/gcc/x86_64-linux-gnu/11/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
npm ERR!     9 | # include_next <stdint.h>

The solution was to install libc6-dev.

$ sudo apt install libc6-dev
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.

So I would like to expand on Olimjon's answer, which gave me an idea for a fix.

I was able to fix it by looking up libc-dev-bin and libc6-dev packages from jammy-updates. Downloaded them and then:

sudo dpkg -i libc-dev-bin_2.35-0ubuntu3.1_amd64.deb
sudo apt install linux-libc-dev libcrypt-dev rpcsvc-proto libtirpc-dev libnsl-dev
sudo dpkg -i libc6-dev_2.35-0ubuntu3.1_amd64.deb
Tony I.
  • 101
-4

have you tried just sudo apt install libc3-dev

also you can type sudo apt search libc3 and that shows me 2 packages

Sorting... Done
Full Text Search... Done
libc3p0-java/bionic,bionic 0.9.1.2-9 all
library for JDBC connection pooling

libc3p0-java-doc/bionic,bionic 0.9.1.2-9 all
library for JDBC connection pooling (documentation)
plutesci
  • 341
  • 1
    libc3 is a completely different library that is not related to and has nothing to do with libc6 which is what the asker is having issues with. libc6 is the standard C libraries. That is a critical component to a ton of software (and libraries and compilers). (The post you've made doesn't have anything to do with the original question or issue that was posted by the asker of this question) – Thomas Ward Jul 16 '18 at 22:17