Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recover after deleting the symbolic link libc.so.6?

In our server the symbolic link to libc.so.6 has been deleted. Now none of the binaries in the system work. To fix this, I tried:

/bin/ln -s /lib/libc-2.11.3.so /lib/libc.so.6 

which, as expected, gives me:

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

I also tried:

/lib/ld-linux-x86-64.so.2  --inhibit-rpath /lib/libc.so.6 \    --library-path /lib/libc-2.11.3.so \    /bin/ln -s /lib/libc-2.11.3.so /lib/libc.so.6 

with the same result. Further unsuccessful attempts include cp, mv, cat.

I'm connected via ssh and I believe I will not be able to open another session after closing this one. Is there a way to fix this system (using bash built-ins perhaps)?

[edit] I did:

while read line; do echo $line; done < /lib/libc-2.11.3.so > libc.so.6 

to copy the file and tried with:

/lib/ld-linux-x86-64.so.2  --inhibit-rpath libc.so.6 --library-path . \   /bin/ln -s /lib/libc-2.11.3.so /lib/libc.so.6 

and got:

/bin/ln: error while loading shared libraries: ./libc.so.6: ELF file OS ABI invalid 
like image 480
perreal Avatar asked Sep 03 '12 14:09

perreal


People also ask

How do I fix libc So 6?

Just mount your root filesystem (which you can usually do with one click in the file browser, though you can use the mount command if you like). Then, in a terminal, use the mv or cp command to restore libc.

Where can I find libc so?

As for the location, it's almost certainly going to be in /usr/lib/libc. a and / or /usr/lib/libc.so .

What package contains libc So 6?

The libc. so. 6 file is present in the libc6 package.

What is libc So 1?

libc.so is a link to libc. so. 1 which is the "base" version of the C library for the implementation of Solaris 10 you are running. Solaris does not work exactly the way Linux does with versions of libc because there are different versions of sparc architecure. The lowest common denominator is sparc 1.


2 Answers

You could simply run ldconfig. Most distributions ship this as a static binary.

like image 178
Simon Richter Avatar answered Oct 02 '22 15:10

Simon Richter


This helped in my case (the actual version depends on your library):

ldconfig -l -v /lib/libc-2.13.so 
like image 39
Adam Avatar answered Oct 02 '22 17:10

Adam