error while loading shared libraries: libc.so.6 accidentally delete libc.so.6 first aid method,

cause of issue:

Compiled a software in a high-version environment, but it cannot be used in a low-version system, lacking libc.so support, but the soft link of libc.so.6 was accidentally deleted during the compilation process, rm /lib64/libc.so .6
 

After deleting, I found that many commands of the system are unavailable, sad reminder!

[root@nagios libexec]# ls

ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

[root@nagios libexec]#

[root@nagios libexec]#

[root@nagios libexec]# ls

ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

[root@nagios libexec]#

[root@nagios libexec]#

[root@nagios libexec]# ping

ping: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

[root@nagios libexec]# sh

sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

[root@nagios libexec]# /bin/sh

/bin/sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

At that time, my little heart, I was almost desperate. The operating environment is still a formal environment. Finally, I found the first aid plan by searching the documents.

Let the system reload so that so executes the following command

[root@nagios libexec]# ldconfig

focus! focus! focus!

 In fact, restarting the system can also solve it, but it was a production environment at that time, and it was very tangled.

I also saw the following method on the Internet, but I haven’t tested it. It should be possible to see the principle.

[root@nagios libexec]#LD_PRELOAD=/lib/libc-2.6.1.so ln -s /lib/libc-2.6.1.so lib/libc.so.6

Let's talk about the libc version upgrade method

When the downloaded software executes and reports the following error, you need to upgrade libc

/lib64/libc.so.6: version `GLIBC_2.14' not found

View the version currently supported by the system

[root@nagios libexec]#strings /lib64/libc.so.6 | grep GLIBC

Download the version that needs to be upgraded. Note that the higher version does not necessarily support the lower version system. It needs to be confirmed on the official website

[root@nagios tmp]#wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gz

[root@nagios tmp]#tar -xvf glibc-2.15.tar.gz

[root@nagios glibc-2.15]#cd glibc-2.15

Create a new directory to store the compiled files

[root@nagios glibc-2.15]#mkdir build

[root@nagios glibc-2.15]#cd build

Configuration, we put the installation files in other places separately, not in the system location, so it is easy to find

[root@nagios build]# ../configure --prefix=/opt/glibc

[root@nagios build]#make -j4

[root@nagios build]#make install

Add the path to the environment variable

[root@nagios build]#export LD_LIBRARY_PATH=/opt/glibc/lib:$LD_LIBRARY_PATH

Then you can test the application, but my problem is still not solved, I installed it from 2.14 to 2.16, and finally gave up

Guess you like

Origin blog.csdn.net/leonnew/article/details/130863856