How to upgrade Glibc library in Ubuntu 22.04

250 views Asked by At

I am currently running a Ubuntu 22.04 VM. It has by default Glibc 2.35. Due to a security vulnerability, I am trying to upgrade it to 2.39.

I followed the following steps to download the gzipped binary and compile it on my system:

sudo apt-get install gawk bison -y
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.39.tar.gz
tar -zxvf glibc-2.39.tar.gz && cd glibc-2.39
mkdir glibc-build && cd glibc-build
../configure --prefix=/opt/glibc-2.39
make 
sudo make install

This compiles and installs successfully. This is the last 10 lines of stdout:

#23 43.04 if test -r /opt/glibc/include/gnu/stubs-64.h && cmp -s /root/workspace/teams/glibc-2.39/glibc-build/stubs.h /opt/glibc/include/gnu/stubs-64.h; \
#23 43.04 then echo 'stubs.h unchanged'; \
#23 43.04 else /usr/bin/install -c -m 644 /root/workspace/teams/glibc-2.39/glibc-build/stubs.h /opt/glibc/include/gnu/stubs-64.h; fi
#23 43.05 rm -f /root/workspace/teams/glibc-2.39/glibc-build/stubs.h
#23 43.05 test ! -x /root/workspace/teams/glibc-2.39/glibc-build/elf/ldconfig || LC_ALL=C \
#23 43.05   /root/workspace/teams/glibc-2.39/glibc-build/elf/ldconfig  \
#23 43.05           /opt/glibc/lib /opt/glibc/lib
#23 43.07 make[1]: Leaving directory '/root/workspace/teams/glibc-2.39'
#23 DONE 43.4s

But after this when I try to run ldd --version, it still points to the old version, i.e 2.35.

How can I point ldd to pick up my latest compiled Glibc library?

1

There are 1 answers

0
Employed Russian On

How can I point ldd to pick up my latest compiled Glibc library?

Invoke the ldd from the directory you built: /opt/glibc-2.39/bin/ldd.

Your next question is likely going to be: "I've set LD_LIBRARY_PATH=/opt/glibc-2.39/lib64, but my application crashes with SIGSEGV (or doesn't run for another reason)".

If so, see this answer.