Linux mistakenly deleted c Basic Runtime libc.so.6 First Aid method

Source: Internet
Author: User

First, popularize the basic knowledge about libc.so.6:

Libc.so.6 is a soft link to glibc

Ll/lib64/libc.so.6
lrwxrwxrwx 1 root root 2014/lib64/libc.so.6-libc-2.5.so

GLIBC is the GNU published LIBC library, the C runtime library. GLIBC is the lowest-level API in a Linux system, and almost any other runtime relies on glibc, so most operations commands are missing it.


How to mistakenly delete the/lib64/libc.so.6, most of the system command will be unable to execute, SSH login system is not successful, will only endlessly prompt the following error:
Error while loading shared Libraries:libc.so.6:cannot open Shared object file:no such file or directory

In this case, most of the commands can no longer be executed, only a small subset of commands, such as Cd,echo, can be performed, while the practical cp,mv are not available
After a variety of Baidu, get the solution (and this method is the premise that SSH has not been disconnected, if SSH is disconnected, you can not reconnect, you have to use another method to restart the CD-ROM into the first aid mode):
Viewing/lib64/on the same version of the system Libc.so.6 know is belong to libc-2.5.so soft link, therefore, libc-2.5.so file must still exist, mistakenly deleted only soft link, but at this time want to re-establish soft link with ln command is a failure, but can force set the variable can be executed successfully

ld_preload=/lib64/libc-2.5.so ln-s/lib64/libc-2.5.so/lib64/libc.so.6

Note that this entire command is executed on the same line and cannot be divided into two lines, otherwise it is invalid.

GLIBC is a very low-level library, Bash also relies on her, so, if the library to kill, basically nothing can be done, but why the previous set ld_preload variable on it? So, ld_preload can affect the program's Runtime link (runtime linker), it allows you to define the program before the first load of the dynamic link library, before the libc.so.6 this soft connection to kill, so the system cannot find this library, but through the Ld_ Preload set glibc The real address of this library can solve this problem.

By setting the Ld_preload variable earlier, you can also perform other commands such as CP,MV.

For example, I did not mistakenly delete the first, just renamed Libc.so.6, which also led to the above error, so you can follow the following method to restore libc.so.6

Ld_preload=/lib64/libc-2.5.so mv/lib64/libc.so.6.bak/lib64/libc.so.6

Linux mistakenly deleted c Basic Runtime libc.so.6 First Aid method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.