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:
在我们的服务器中,符号链接到libc.so。6已被删除。现在系统中的二进制文件都没有工作。为了解决这个问题,我尝试了:
/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.
与相同的结果。进一步的失败尝试包括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)?
我是通过ssh连接的,我相信在关闭这个程序后我将无法打开另一个会话。是否有办法修复这个系统(可能使用bash内置)?
[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
6 个解决方案
#1
28
You could simply run ldconfig
. Most distributions ship this as a static binary.
您可以简单地运行ldconfig。大多数发行版都将其作为静态二进制文件。
#2
9
This helped in my case (the actual version depends on your library):
这对我的情况有帮助(实际的版本依赖于您的库):
ldconfig -l -v /lib/libc-2.13.so
#3
8
Try:
试一试:
LD_PRELOAD=/lib/libc-2.17.so ln -s /lib/libc-2.17.so /lib/libc.so.6
Note: The actual version depends on your library.
注意:实际的版本取决于您的库。
#4
4
Boot using a live cd like Knoppix or whatever and fix the missing link after mounting the disk with the "broken" system out of the running live system.
使用像Knoppix这样的live cd或任何其他的方法来启动,并在将磁盘安装到运行的实时系统中的“坏”系统后修复丢失的链接。
#5
3
Note, for 64 bit:
注意,64位:
LD_PRELOAD=libc-2.13.so ln -s libc-2.13.so libc.so.6
LD_PRELOAD = libc - 2.13。所以ln - s libc - 2.13。所以libc.so.6
This worked great for me
这对我来说很有用。
If you are not in that directory of course it will be something like:LD_PRELOAD=/lib/x86_64-linux-gnu/libc-2.13.so ln -s /lib/x86_64-linux-gnu/libc-2.13.so /lib/x86_64-linux-gnu/libc.so.6
如果您不在该目录中,它将会是:LD_PRELOAD=/lib/x86_64- linuxgnu /libc-2.13。所以ln - s /lib/x86_64-linux-gnu / libc - 2.13。所以/lib/x86_64-linux-gnu / libc.so.6
#6
2
If you had done an ls command previously and know what the version of the libc is,
如果你之前做过ls命令并且知道libc的版本是什么,
ldconfig -l -v /lib64/libc-2.x.so
where x
is your version works. Note that it could be a lib64 or lib depending on your version.
其中x是你的版本。注意,它可以是lib64或lib,这取决于您的版本。
I just did this and it worked.
我就是这么做的。
In short, never delete the link. Bad idea.
简而言之,永远不要删除链接。坏主意。
#1
28
You could simply run ldconfig
. Most distributions ship this as a static binary.
您可以简单地运行ldconfig。大多数发行版都将其作为静态二进制文件。
#2
9
This helped in my case (the actual version depends on your library):
这对我的情况有帮助(实际的版本依赖于您的库):
ldconfig -l -v /lib/libc-2.13.so
#3
8
Try:
试一试:
LD_PRELOAD=/lib/libc-2.17.so ln -s /lib/libc-2.17.so /lib/libc.so.6
Note: The actual version depends on your library.
注意:实际的版本取决于您的库。
#4
4
Boot using a live cd like Knoppix or whatever and fix the missing link after mounting the disk with the "broken" system out of the running live system.
使用像Knoppix这样的live cd或任何其他的方法来启动,并在将磁盘安装到运行的实时系统中的“坏”系统后修复丢失的链接。
#5
3
Note, for 64 bit:
注意,64位:
LD_PRELOAD=libc-2.13.so ln -s libc-2.13.so libc.so.6
LD_PRELOAD = libc - 2.13。所以ln - s libc - 2.13。所以libc.so.6
This worked great for me
这对我来说很有用。
If you are not in that directory of course it will be something like:LD_PRELOAD=/lib/x86_64-linux-gnu/libc-2.13.so ln -s /lib/x86_64-linux-gnu/libc-2.13.so /lib/x86_64-linux-gnu/libc.so.6
如果您不在该目录中,它将会是:LD_PRELOAD=/lib/x86_64- linuxgnu /libc-2.13。所以ln - s /lib/x86_64-linux-gnu / libc - 2.13。所以/lib/x86_64-linux-gnu / libc.so.6
#6
2
If you had done an ls command previously and know what the version of the libc is,
如果你之前做过ls命令并且知道libc的版本是什么,
ldconfig -l -v /lib64/libc-2.x.so
where x
is your version works. Note that it could be a lib64 or lib depending on your version.
其中x是你的版本。注意,它可以是lib64或lib,这取决于您的版本。
I just did this and it worked.
我就是这么做的。
In short, never delete the link. Bad idea.
简而言之,永远不要删除链接。坏主意。