How to Install libc.so.6 on Linux (glibc Package, Not a Download)

Deepak Prasad
Tested on RHEL 10.2 (Coughlan) — vm1.lab.example
Package glibc 2.39-128.el10_2 (GNU C Library)
Applies to RHEL, Rocky Linux, AlmaLinux, Fedora, Ubuntu, Debian, and other Linux systems using glibc
Privilege sudo or root for package install; rescue media for broken-system recovery
Scope Error-first diagnosis for libc.so.6 / GLIBC_2.XX failures, installed glibc checks, version and architecture mismatches, multilib, and reinstall from a working system or rescue environment. Does not cover building a full alternate glibc prefix or musl-only static binaries.
Related guides DNF command
dpkg command
RPM failed dependencies
Download RPM with dependencies
RPM vs DEB packages

Search phrases like install libc.so.6 or libc.so.6 download usually hide a specific failure message. Match your error first — the fix depends on whether glibc is missing, too old for the binary, or the wrong architecture.

If the library file is missing or damaged, reinstall the glibc package from your distribution — not a standalone libc.so.6 file from the web. If the error says GLIBC_2.XX not found, reinstalling the same package usually does not help; the installed glibc is too old for that program. Upgrade the OS, rebuild the application on the target host, or run it in a compatible container instead.


Which libc.so.6 error do you have?

Start here. The message tells you which section to read — not every error means “install glibc.”

Error Meaning First action
libc.so.6: version 'GLIBC_2.XX' not found Binary needs a newer glibc than this OS provides Compare required vs installed GLIBC versions — Fix GLIBC_2.XX not found
libc.so.6: cannot open shared object file from your program only Loader cannot locate a usable libc for that binary, chroot, or container Run file, ldd, and readelf on the failing binary — Fix cannot open shared object file
Same cannot open... from ls, bash, sudo, dnf, apt System libc may be damaged, renamed, or missing Boot rescue media — Reinstall when the system copy is damaged
wrong ELF class: ELFCLASS32 / ELFCLASS64 32-bit vs 64-bit mismatch Inspect the failing binary — Fix 32-bit libc on 64-bit Linux
libfoo.so: cannot open shared object file (not libc) Ordinary missing library package or path Install the named library; use ldconfig for custom paths — not a glibc reinstall

Someone arriving with /lib64/libc.so.6: version 'GLIBC_2.34' not found should understand within the first screen that reinstalling glibc is usually not the solution.


What libc.so.6 is

libc.so.6 is not a third-party library you add beside your project. It is the runtime GNU C Library (glibc) the dynamic linker loads for most compiled programs.

Name you see What it is
/lib64/libc.so.6 64-bit glibc on RHEL, Rocky, AlmaLinux, Fedora
/lib/x86_64-linux-gnu/libc.so.6 64-bit glibc on Debian and Ubuntu
glibc RPM Package that owns the library on RHEL family systems
libc6 package Package that owns the library on Debian and Ubuntu

The .so.6 suffix marks glibc major version 6 (the library people call glibc 2.x). RHEL family systems ship it as the glibc RPM; Debian and Ubuntu ship it as libc6.


Check the installed glibc version

Before you change packages, confirm what the host already provides.

See whether the system library file exists:

bash
ls -l /lib64/libc.so.6

Sample output on the lab host:

output
-rwxr-xr-x. 1 root root 2343992 Jul  7 05:30 /lib64/libc.so.6

Ask the loader which glibc version is active:

bash
ldd --version | head -1

Sample output:

output
ldd (GNU libc) 2.39

Map the file back to the owning package when you need to reinstall the exact build. On RHEL family systems:

bash
rpm -qf /lib64/libc.so.6

Sample output:

output
glibc-2.39-128.el10_2.x86_64

On Debian or Ubuntu, dpkg reports ownership:

bash
dpkg -S libc.so.6

Expected line on amd64:

text
libc6:amd64: /lib/x86_64-linux-gnu/libc.so.6

If ldd --version works but your program still fails, the problem is usually version mismatch, architecture, or loader path — not a missing download.


Fix libc.so.6: version GLIBC_2.XX not found

When the error names a GLIBC_2.XX symbol, glibc is present but too old for that binary.

Backward compatibility rule: older binaries generally run on newer glibc, but newer binaries may not run on older glibc. When software is built against a symbol introduced in glibc 2.34, a machine providing only glibc 2.31 cannot satisfy that requirement — reinstalling libc6 2.31 does not add the missing symbol. The glibc symbols referenced when the program is linked determine its minimum glibc requirement. Building on a newer distribution can introduce newer symbol requirements, but the required version is not automatically the build host’s full glibc version — use objdump -T below to find the actual floor.

Compare what the host provides vs what the binary requires

See the highest GLIBC symbols your installed library exports:

bash
strings /lib64/libc.so.6 | grep '^GLIBC_2\.' | sort -Vu | tail -3

Sample output on the lab host:

output
GLIBC_2.36
GLIBC_2.38
GLIBC_2.39

List the GLIBC versions the failing executable requires from its dynamic symbol table (replace the path with your binary):

bash
objdump -T ./myprogram | grep -o 'GLIBC_[0-9.]*' | sort -Vu | tail -5

Sample output when ./myprogram is a 64-bit program on the lab host:

output
GLIBC_2.26
GLIBC_2.28
GLIBC_2.33
GLIBC_2.34
GLIBC_2.38

The highest referenced GLIBC_2.xx version is the binary’s minimum glibc symbol-version requirement. If it requires GLIBC_2.34 but the host provides only up to GLIBC_2.31, that host’s glibc cannot satisfy the binary. For normal glibc-linked programs this is the key diagnostic; a runnable environment can still depend on the dynamic loader, architecture, kernel expectations, and other libraries.

Supported fixes:

  • Upgrade the operating system to a release that provides the required glibc.
  • Rebuild the application on the target OS so it links against the glibc that is actually installed.
  • Run in a container with a base image new enough for the binary (Docker, Podman, systemd-nspawn).

Use an isolated alternate glibc/runtime environment only if you understand dynamic-loader compatibility; that is an advanced option and is outside this guide’s scope.

What not to do:

  • Do not overwrite /lib64/libc.so.6 or /lib/x86_64-linux-gnu/libc.so.6 with a file from another machine.
  • Do not enable a newer-release glibc repository on an older OS — mixing glibc builds can break the system just like manually replacing libc.so.6.

Fix libc.so.6: cannot open shared object file

This message covers several different problems. Split them before you reinstall anything.

Situation Likely cause
Only your program (or a chroot/container app) fails Architecture mismatch, wrong loader, broken symlink in an isolated tree, or renamed libc in that environment
ls, sudo, bash, dnf, apt also fail with the same error System libc.so.6 itself may be damaged, deleted, or renamed

Inspect the failing binary

Replace ./myprogram with the path from your error. On the lab host we use a copied binary under /tmp/libc-lab/:

bash
file ./myprogram

Sample output:

output
./myprogram: ELF 64-bit LSB pie executable, x86-64, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped

See whether the dynamic linker can resolve libc.so.6 for that binary:

bash
ldd ./myprogram | grep libc

Sample output when resolution succeeds:

output
libc.so.6 => /lib64/libc.so.6 (0x00007fcbca0e6000)

Check which program interpreter (dynamic loader) the ELF file expects:

bash
readelf -l ./myprogram | grep 'Requesting program interpreter'

Sample output:

output
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

If libc.so.6 exists on disk but ldd still reports not found, compare the interpreter path and architecture from file with what is installed. A 32-bit binary on a 64-bit-only host, a broken chroot, or a corrupted loader symlink can produce this error even when /lib64/libc.so.6 is present.

When only a third-party library such as libfoo.so is missing — not libc.so.6 — install the named package or refresh custom library paths with ldconfig. That is an ordinary dependency problem, not a glibc reinstall.


Reinstall libc.so.6 when the system copy is damaged

Use this branch when the system file is missing or corrupt — especially when core commands fail.

If the package manager still works

When ls, sudo, and dnf or apt still run, reinstall the distribution package:

bash
sudo dnf reinstall glibc

On Debian or Ubuntu:

bash
sudo apt update
sudo apt install --reinstall libc6

Verify the package list on RHEL family systems:

bash
dnf list installed 'glibc*'

Sample output (trimmed):

output
glibc.x86_64           2.39-128.el10_2
glibc-common.x86_64    2.39-128.el10_2

If ls, sudo, or the package manager no longer run

When commands such as ls, sudo, or the package manager themselves fail with libc.so.6: cannot open shared object file, you usually cannot repair glibc from the normal booted environment — those tools also depend on glibc.

Boot rescue or live media, mount the installed root filesystem, and reinstall the exact matching glibc or libc6 package from outside the broken root. Red Hat documents this recovery path for RHEL family systems when the dynamic linker can no longer start system programs.

IMPORTANT
Do not replace the system libc.so.6 with a copy downloaded elsewhere. Core commands depend on the exact build your distribution tested. Overwriting it can leave the system unbootable.

Fix 32-bit libc.so.6 on 64-bit Linux

A 64-bit installation without multilib normally has only its native 64-bit glibc. On RHEL-family x86_64 systems that is typically /lib64/libc.so.6; Debian and Ubuntu use architecture-specific paths such as /lib/x86_64-linux-gnu/libc.so.6. A 32-bit program needs the 32-bit glibc and loader as well.

Start with the failing binary, not a known-good system command:

bash
file ./myprogram

A 32-bit program reports ELF 32-bit and an interpreter such as /lib/ld-linux.so.2:

text
./myprogram: ELF 32-bit LSB executable, Intel 80386, dynamically linked, interpreter /lib/ld-linux.so.2

Check what ldd resolves:

bash
ldd ./myprogram

If you see wrong ELF class or not found for libc.so.6, install multilib support.

On RHEL family 64-bit hosts:

bash
sudo dnf install glibc.i686

On Debian or Ubuntu, enable multiarch when the failing package is built for the i386 architecture:

bash
sudo dpkg --add-architecture i386

Refresh indexes after adding the architecture:

bash
sudo apt update

Install 32-bit glibc through multiarch:

bash
sudo apt install libc6:i386

The libc6-i386 package on amd64 provides 32-bit runtime compatibility libraries without pulling full :i386 architecture dependencies — useful on some systems, but prefer libc6:i386 when Debian packages explicitly require the i386 architecture.


If libc.so.6 exists but the program still cannot load it

When ls -l /lib64/libc.so.6 succeeds and ldd --version works, yet one binary fails, focus on that program’s loader and architecture — not generic /usr/local/lib advice.

Confirm the on-disk library path matches your distribution layout:

bash
readlink -f /lib64/libc.so.6

Sample output:

output
/usr/lib64/libc.so.6

Re-run the interpreter and architecture checks on the failing binary:

bash
readelf -l ./myprogram | grep 'Requesting program interpreter'

A binary built for /lib/ld-linux-armhf.so.3 cannot use x86_64 libc.so.6 even if the file exists. Likewise, a program inside a chroot or container must see libc.so.6 inside that root filesystem, not only on the host.

When a non-glibc shared library in /usr/local/lib is missing, rebuild the linker cache after installing the vendor library:

bash
sudo ldconfig

Do not use LD_LIBRARY_PATH to point at another glibc tree — that can mix loader and runtime components unpredictably.


Verify the fix

After any change, confirm the failing binary resolves libraries and starts.

Re-check dynamic linking on the program:

bash
ldd ./myprogram | grep -E 'libc|not found'

ldd should no longer report required libraries as not found.

Confirm separately that the ELF interpreter exists on the target system:

bash
readelf -l ./myprogram | grep 'Requesting program interpreter'

The path shown (for example /lib64/ld-linux-x86-64.so.2 on x86_64 RHEL) must be present on disk in the same root filesystem the binary runs from.

Run the program directly when safe:

bash
./myprogram --help

If you reinstalled the system package, confirm ownership and version again:

bash
rpm -qf /lib64/libc.so.6

Sample output:

output
glibc-2.39-128.el10_2.x86_64

For a GLIBC_2.XX mismatch, re-run objdump -T on the binary and compare its highest required symbol against strings /lib64/libc.so.6 | grep '^GLIBC_2\.' | sort -Vu | tail -1.


Troubleshooting

Symptom Likely cause Fix
how to install libc.so.6 but ldd --version works Misunderstanding — glibc already installed Use the error table above
libc.so.6 download search Expecting a standalone file Install glibc or libc6 with the package manager when the file is actually missing
GLIBC_2.34 not found on old OS Binary floor above host glibc Upgrade OS, rebuild, or container — not reinstall same libc6
cannot open... from ls/sudo only System libc damaged Rescue environment + matching package reinstall
cannot open... from one app only Arch, chroot, loader, or path issue file, ldd, readelf on that binary
wrong ELF class 32/64-bit mismatch glibc.i686 or Debian multiarch libc6:i386
Broke system after manual libc.so.6 copy Unsupported replacement Boot recovery media; reinstall official package

References


Summary

Most install libc.so.6 searches are really troubleshooting searches. Classify the exact error first: GLIBC_2.XX not found means the binary needs a newer glibc than the OS provides — compare required symbols with objdump -T against what strings /lib64/libc.so.6 exports, then upgrade, rebuild, or containerize. Reinstalling the same package does not raise the symbol ceiling.

libc.so.6: cannot open shared object file splits into two cases. When only your program fails, inspect it with file, ldd, and readelf. When ls, sudo, or the package manager fail too, boot rescue media and reinstall the matching glibc or libc6 package into the installed root.

For 32-bit vs 64-bit mismatches, start with file ./myprogram, then add glibc.i686 on RHEL family systems or Debian multiarch with libc6:i386. Verify with ldd and a test run before you call the fix done.

Never download libc.so.6 from the web and drop it into /lib. The supported path is always the distribution package — or an environment (container, newer OS, rebuilt binary) whose glibc matches what the program requires.


Frequently Asked Questions

1. Can I download libc.so.6 and copy it into /lib?

No. libc.so.6 is the GNU C Library shipped and versioned by your distribution. Replacing the system copy breaks core tools such as ls, sudo, and ssh. Install or reinstall glibc through your package manager, or run the application in a container or chroot with a matching glibc version.

2. Is libc.so.6 the same as the libc6 package on Ubuntu?

Yes. On Debian and Ubuntu the libc6 package installs /lib/x86_64-linux-gnu/libc.so.6. On RHEL family systems the glibc RPM installs /lib64/libc.so.6. Both names refer to GNU glibc, not a separate downloadable library file.

3. What does libc.so.6 version GLIBC_2.34 not found mean?

Your binary references a glibc symbol newer than the one on this host. The glibc symbols referenced when the program is linked determine its minimum requirement — building on a newer distribution can introduce newer symbol needs, but the required version is not automatically the build host full glibc version. Upgrade the operating system to a release that provides the required glibc, rebuild the application on the current OS, or run it in a compatible container. Reinstalling the same libc6 package will not add newer GLIBC symbols.

4. How do I install 32-bit libc.so.6 on a 64-bit system?

On RHEL family hosts install glibc.i686 with dnf or yum. On Debian or Ubuntu, libc6-i386 provides 32-bit runtime libraries on amd64; for software packaged for the i386 architecture, enable multiarch with dpkg --add-architecture i386, then install libc6:i386. Confirm with file and ldd on the failing binary.

5. Why does libc.so.6 cannot open shared object file appear for ls or sudo?

When core commands fail with that message, the system libc itself may be damaged, renamed, or missing — not just a third-party program. You usually cannot repair glibc from the normal booted environment. Boot rescue or live media and reinstall the matching glibc or libc6 package into the installed root filesystem.
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware.

  • Debian
  • Ubuntu
  • Linux
  • Red Hat Enterprise Linux
  • Shell Script
  • System Administration