72

I heard I can do it using apt-get install libc6, but I need to add something to /etc/apt/sources.list to receive the newest glibc version.

What should I do?

Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
antpetr89
  • 1,143
  • 3
  • 12
  • 14

4 Answers4

92

I was able to install libc6 2.17 in Debian Wheezy by editing the recommendations in perror's answer:

IMPORTANT
You need to exit out of your display manager by pressing CTRL-ALT-F1. Then you can stop x (slim) with sudo /etc/init.d/slim stop

(replace slim with mdm or lightdm or whatever)

Add the following line to the file /etc/apt/sources.list:

deb http://ftp.debian.org/debian experimental main

Should be changed to:

deb http://ftp.debian.org/debian sid main

Then follow the rest of perror's post:

Update your package database:

apt-get update

Install the glibc package:

apt-get -t sid install libc6-amd64 libc6-dev libc6-dbg

IMPORTANT
After done updating libc6, restart computer, and you should comment out or remove the sid source you just added (deb http://ftp.debian.org/debian sid main), or else you risk upgrading your whole distro to sid.

starball
  • 20,030
  • 7
  • 43
  • 238
0E 800
  • 921
  • 6
  • 2
  • 2
    This post should receive more attention. It is an update to perror's post, and it actually fixes the problem the other post had – B. Decoster Nov 28 '13 at 00:32
  • 9
    Note that I had to replace `apt-get -t sid install libc6-amd64 libc6-dev libc6-dbg` by `apt-get -t sid install libc6 libc6-dev libc6-dbg` but it worked fined, because it was the amd64 version that was installed – B. Decoster Nov 28 '13 at 04:47
  • @Fezvez: have you had any problem after removing the `deb http://ftp.debian.org/debian sid main` line of your `/etc/apt/sources.list` file? – Throoze Mar 11 '14 at 23:20
  • Awesome, this helped me get Steam going in Kali-Linux – Routhinator Aug 04 '14 at 03:07
  • 10
    Instead of removing the sid source from /etc/apt/sources.list again, you could Apt-Pinning to ensure that nothing else gets accidentally updated: http://jaqque.sbih.org/kplug/apt-pinning.html – Jürg Lehni Sep 09 '14 at 14:56
  • updating glibc from wheezy to jessie also needs `locales` pagkage be updated through testing (jessie) repos, otherwise it is removed completely – nikos.svnk Jan 17 '15 at 17:06
  • 3
    +1. And see also https://wiki.debian.org/DebianExperimental to know how to track **only** one package from `sid`/`experimental` while staying on `stable` branch. _+1 to @JürgLehni comment._ – 1111161171159459134 Jul 03 '15 at 20:40
  • Without the tweaks in the comments, this will eventually migrate more and more of your system to `sid` as packages are being upgraded. You will end up with a hybrid `wheezy` / `sid` installation. A less confusing solution is to upgrade to a newer stable distribution; currently, Jessie has [`glibc` version 2.19](https://packages.debian.org/source/jessie/glibc). – tripleee Nov 10 '15 at 08:14
  • I did everything as you both guys said and I have a problem, because after apt-get -t sid install libc6-amd64 libc6-dev libc6-dbg it wants to delete a lot of files 30 upgraded, 2 newly installed, 227 to remove and 71 not upgraded. Need to get 25.6 MB of archives. After this operation, 972 MB disk space will be freed. Can I safely enter Y? 227 libraries is a lot. – kuba12 Feb 16 '16 at 22:31
53

WARNING!!! This solution is now OBSOLETE try to find a more recent one in the list!


In fact you cannot do it easily right now (at the time I am writing this message). I will try to explain why.

First of all, the glibc is no more, it has been subsumed by the eglibc project. And, the Debian distribution switched to eglibc some time ago (see here and there and even on the glibc source package page). So, you should consider installing the eglibc package through this kind of command:

apt-get install libc6-amd64 libc6-dev libc6-dbg

Replace amd64 by the kind of architecture you want (look at the package list here).

Unfortunately, the eglibc package version is only up to 2.13 in unstable and testing. Only the experimental is providing a 2.17 version of this library. So, if you really want to have it in 2.15 or more, you need to install the package from the experimental version (which is not recommended). Here are the steps to achieve as root:

  1. Add the following line to the file /etc/apt/sources.list:

     deb http://ftp.debian.org/debian experimental main
    
  2. Update your package database:

     apt-get update
    
  3. Install the eglibc package:

     apt-get -t experimental install libc6-amd64 libc6-dev libc6-dbg
    
  4. Pray!

Well, that's all folks.

perror
  • 7,071
  • 16
  • 58
  • 85
28

Your script contains errors as well, for example if you have dos2unix installed your install works but if you don't like I did then it will fail with dependency issues.

I found this by accident as I was making a script file of this to give to my friend who is new to Linux and because I made the scripts on windows I directed him to install it, at the time I did not have dos2unix installed thus I got errors.

here is a copy of the script I made for your solution but have dos2unix installed.

#!/bin/sh
echo "deb http://ftp.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get update
apt-get -t sid install libc6 libc6-dev libc6-dbg
echo "Please remember to hash out sid main from your sources list. /etc/apt/sources.list"

this script has been tested on 3 machines with no errors.

Ale
  • 1,998
  • 19
  • 31
blackice504
  • 289
  • 3
  • 3
4

Update 2022

If you need to upgrade glibc, the safest solution may be to upgrade your Linux distribution, since most software depends on glibc.

Check your current version of glibc

ldd --version

glibc versions associated with Debian distributions

Take a look at: tracker.debian.org/pkg/glibc

Upgrade your Debian distribution

Excerpts from ​How to Upgrade Debian 10 Buster to Debian 11 Bullseye

  1. Backup your data
  2. Update currently installed packages
    • Packages marked as held back cannot be automatically installed, upgraded or removed. This may cause issues during the upgrade process. To check whether there are held back packages: sudo apt-mark showhold
    • If there are on hold packages, you should either unhold the packages with sudo apt-mark unhold package_name or make sure the packages will not interfere with the upgrade process.
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
  1. Upgrade Debian distribution
    • Edit /etc/apt/sources.list: sudo nano /etc/apt/sources.list
    • Update distribution name. See Debian SourcesList Wiki
    • Set the terminal output to English only: export LC_ALL=C
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
sudo systemctl reboot
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117