If the package has the same version and the proper provides/replaces then it should work. Answer from MrElendig on reddit.com
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-from-scratch-13 › safe-glibc-replacing-with-a-newer-one-263920
Safe glibc replacing with a newer one
I want to completely replace old glibc with newer one. To do this more safely, I decided to put new glibc into /usr/local for a first time, build all
🌐
Reddit
reddit.com › r/archlinux › how to replace glibc without breaking the system
r/archlinux on Reddit: How to replace Glibc without breaking the system
November 1, 2024 -

I am trying to replace glibc with glibc-eac-bin to get insurgency sandstorm working again.

I found online that you can use ‘yay -S glibc-eac-bin lib32-eac-bin’ and that should work. However, whenever I try this, I get a unresolvable conflict due to conflict with glibc.

I tried removing and replacing glibc with the new one (even in one line) and broke my system twice (fixed it with pacstrap bc glibc didn’t seem to install without it).

How do I install glibc-eac-bin and resolve the conflict and without breaking my system?

🌐
Reddit
reddit.com › r/voidlinux › is it possible to replace glibc with musl without reinstalling?
r/voidlinux on Reddit: Is it possible to replace glibc with musl without reinstalling?
February 14, 2021 - xchroot /glibc · Restore packages: xargs xbps-install -Sy < /installed.txt · Boot Void Linux from USB (IMPORTANT) and replace glibc root: mv /usr /usr.musl mv /glibc/usr /usr · Then chroot into /, configure locales, adjust configuration files ...
Top answer
1 of 13
352

It is very possible to have multiple versions of GLIBC on the same system (we do that every day).

However, you need to know that GLIBC consists of many pieces (200+ shared libraries) which all must match. One of the pieces is ld-linux.so.2 (ld-linux-x86-64.so.2 on x86_64 systems), and it must match libc.so.6, or you'll see the errors you are seeing.

The absolute path to ld-linux.so.2 is hard-coded into the executable at link time, and can not be easily changed after the link is done (Update: can be done with patchelf; see this answer below).

To build an executable that will work with the new GLIBC, do this:

g++ main.o -o myapp ... \
   -Wl,--rpath=/path/to/newglibc \
   -Wl,--dynamic-linker=/path/to/newglibc/ld-linux.so.2

The -rpath linker option will make the runtime loader search for libraries in /path/to/newglibc (so you wouldn't have to set LD_LIBRARY_PATH before running it), and the -dynamic-linker option will "bake" path to correct ld-linux.so.2 into the application.

If you can't relink the myapp application (e.g. because it is a third-party binary), not all is lost, but it gets trickier. One solution is to set a proper chroot environment for it. Another possibility is to use rtldi and a binary editor.

Update: or you can use patchelf on existing binaries to redirect them to the alternate libc.

2 of 13
167

This question is old, the other answers are old. Employed Russian's answer is very good and informative, but it only works if you have the source code. If you don't, the alternatives back then were very tricky. Fortunately nowadays we have a simple solution to this problem (as commented in one of his replies), using patchelf. All you have to do is:

$ ./patchelf --set-interpreter /path/to/newglibc/ld-linux.so.2 --set-rpath /path/to/newglibc/ myapp

This changes the non-working executable to use a different path for its linker. And after that, you can just execute your file:

$ ./myapp

No need to chroot or manually edit binaries, thankfully. But remember to backup your binary before patching it, if you're not sure what you're doing, because it modifies your binary file. After you patch it, you can't restore the old path to interpreter/rpath. If it doesn't work, you'll have to keep patching it until you find the path that will actually work... Well, it doesn't have to be a trial-and-error process. For example, in OP's example, he needed GLIBC_2.3, so you can easily find which lib provides that version using strings:

$ strings /lib/i686/libc.so.6 | grep GLIBC_2.3
$ strings /path/to/newglib/libc.so.6 | grep GLIBC_2.3

In theory, the first grep would come empty because the system libc doesn't have the version he wants, and the 2nd one should output GLIBC_2.3 because it has the version myapp is using, so we know we can patchelf our binary using that path. If you get a segmentation fault, read the note at the end.

When you try to run a binary in linux, the binary tries to load the linker (aka loader, aka interpreter), then the libraries, and they should all be in the path and/or in the right place. If your problem is with the linker and you want to find out which path your binary is looking for, you can find out with this command:

$ readelf -l myapp | grep interpreter
  [Requesting program interpreter: /lib/ld-linux.so.2]                                                                                                                                                                                   

If your problem is with the libs, commands that will give you the libs being used are:

$ readelf -d myapp | grep Shared
$ ldd myapp 

This will list the libs that your binary needs, but you probably already know the problematic ones, since they are already yielding errors as in OP's case. After you do patchelf, it might happen that myapp is still not working, and when you run ldd myapp it lists the libs with mixed paths, some to the path you set, others to the original system path. That's because your path doesn't have those libs. rpath will search for the lib in the path you set, but if it's not there, it still looks for it in the other system locations. In this case, if you have the missing lib somewhere, just copy it to the rpath that you chose and it should work.

"patchelf" works for many different problems that you may encounter while trying to run a program, related to these 2 problems. For example, if you get: ELF file OS ABI invalid, it may be fixed by setting a new loader (the --set-interpreter part of the command) as I explain here. Another example is for the problem of getting No such file or directory when you run a file that is there and executable, as exemplified here. In that particular case, OP was missing a link to the loader, but maybe in your case you don't have root access and can't create the link. Setting a new interpreter would solve your problem.

Thanks Employed Russian and Michael Pankov for the insight and solution!


Note for segmentation fault: you might be in the case where myapp uses several libs, and most of them are ok but some are not; then you patchelf it to a new dir, and you get segmentation fault. When you patchelf your binary, you change the path of several libs, even if some were originally in a different path. Take a look at my example below:

$ ldd myapp
./myapp: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./myapp)
./myapp: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./myapp)
        linux-vdso.so.1 =>  (0x00007fffb167c000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9a9aad2000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9a9a8ce000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9a9a6af000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9a9a3ab000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9a99fe6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9a9adeb000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9a99dcf000)

Note that most libs are in /lib/x86_64-linux-gnu/ but the problematic one (libstdc++.so.6) is on /usr/lib/x86_64-linux-gnu. After I patchelf'ed myapp to point to /path/to/mylibs, I got segmentation fault. For some reason, the libs are not totally compatible with the binary. Since myapp didn't complain about the original libs, I copied them from /lib/x86_64-linux-gnu/ to /path/to/mylibs2, and I also copied libstdc++.so.6 from /path/to/mylibs there. Then I patchelf'ed it to /path/to/mylibs2, and myapp works now. If your binary uses different libs, and you have different versions, it might happen that you can't fix your situation. :( But if it's possible, mixing libs might be the way. It's not ideal, but maybe it will work. Good luck!

🌐
Devtuts
devtuts.net › en › linux › how-to-update-glibc.html
How to update glibc - DevTuts
January 19, 2026 - # Debian / Ubuntu / Kali sudo apt-get update && sudo apt-get install --reinstall libc6 # RHEL / CentOS / Rocky / AlmaLinux sudo yum reinstall glibc # or: sudo dnf reinstall glibc # openSUSE / SLES sudo zypper in --force glibc · If a newer release is only available in a newer distribution version, ...
🌐
Reddit
reddit.com › r › linux › comments › 1be4xl › systemd_to_replace_glibc
r/linux - systemd to replace glibc
August 15, 2015 - I was hoping for a new library, gliblibc, so developers wouldn't be burdened with having to directly access glibc.
🌐
Reddit
reddit.com › r/ubuntu › how do i update glibc?
r/Ubuntu on Reddit: How do I update GLIBC?
July 24, 2025 -

I’m currently using GLIBC 2.35 on Ubuntu 22.04, and I want to update it (for gaming purposes).

I’m also aware that updating it isn’t as simple as typing:

“sudo apt update GLIBC yada yada”

or whatever, so I’m not entirely sure how to update it properly without bricking my install.

Any ideas on what to do?

Find elsewhere
🌐
The Fedora Project
fedoraproject.org › wiki › Changes › Replace_glibc_libcrypt_with_libxcrypt
Changes/Replace glibc libcrypt with libxcrypt - Fedora Project Wiki
March 2, 2018 - Since there has been some discussion in the last time about removing libcrypt from glibc in some time and splitting it out into a separate project which can evolve quicker, Zack Weinberg and I put some work into libxcrypt to make it a basically suitable replacement.
🌐
Reddit
reddit.com › r/debian › how do i get a newer version of glibc? (2.38 or above?)
r/debian on Reddit: How do i get a newer version of glibc? (2.38 or above?)
June 9, 2024 -

Basically im trying to run a game but it requires at least glibc 2.38 but it seems debian only offers 2.36 at the moment. Any way i can get a newer vesion of it?

EDIT: ended up just downloading the windows version of the game and running it with wine, im an idiot and thought i was having a problem with the sound when i first downloaded, that's why i tried the linux binary, but when i ran it with wine again i found out that the game came muted by default and that i had to press + to get the volume up

🌐
Jertype
jertype.com › upgrading-glibc
Using newer libc on old Linux distributions - Jertype
April 21, 2018 - This will install glibc into /opt/glibc-2.14 but if you run ldd --version it will still report the old version.
🌐
Puppy Linux Discussion Forum
forum.puppylinux.com › board index › puppy linux main › house training › users help
How exactly do you update glibc? - Puppy Linux Discussion Forum
On numerous occasions , I simply used my package extraction tool to rip a newer glibc package from a newer Puppy and use it with an older Puppy by loading it as an additional drive (like an adrv). It normally works.
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-from-scratch-13 › how-to-upgrade-glibc-4175599783-print
LinuxQuestions.org - How to upgrade glibc
July 19, 2021 - - - How to upgrade glibc (https://www.linuxquestions.org/questions/linux-from-scratch-13/how-to-upgrade-glibc-4175599783/)
🌐
Stack Overflow
stackoverflow.com › questions › 36036610 › installing-new-glibc-while-keeping-old-version
Installing new GLIBC while keeping old version - Stack Overflow
Have you read the very first paragraph of that page? configure takes many options, but the only one that is usually mandatory is --prefix. The GNU C Library cannot be compiled in the source directory. So you should read that and then run $ ../glibc-version/configure --prefix=~/libc and then make
🌐
Linux Mint Forums
forums.linuxmint.com › board index › chat › chat about linux mint
Has anyone made any attempt to upgrade glibc? - Linux Mint Forums
January 27, 2024 - strings /usr/lib/x86_64-linux-... GLIBC_2.30 GLIBC_2.31 GLIBC_2.32 GLIBC_2.33 GLIBC_2.34 GLIBC_2.35 GLIBC_PRIVATE So, the idea would be to install glibc 2.38 to be able to use programs requiring it, without breaking the system....
🌐
OpenGenus
iq.opengenus.org › install-specific-version-of-glibc
Install specific version of Glibc
October 17, 2022 - In this article, we have mentioned the steps to illustrate how to download and install a specific version of Glibc so that you can resolve glibc related issues. The latest version of Glibc is v2.36.