0

I accidently renamed /lib/x86_64-linux-gnu/libc.so.6 to /lib/x86_64-linux-gnu/libc.so.6-bak

Now I can not perform some commands such as

ls ll vim wget. . . . . it is showing the following error whenever I try to execute any command

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

I can not rename it back

1

I suppose you'd have to find a statically linked program (like busybox if you have busybox-static installed or something) with which you could move it back, or else boot from a rescue disk, like an ubuntu live CD or someting, and do it from there.

  • 1
    The dynamic loaded itself (ld.so probably named /lib/ld-linux.so.2) is static, and interprets env variables when executing dynamic commands. So LD_PRELOAD=/lib/x86_64-linux-gnu/libc.so.6-bak mv /lib/x86_64-linux-gnu/libc.so.6-bak /lib/x86_64-linux-gnu/libc.so.6 would work if root. but it won't for sudo (or su) because forbidden (and anyway will fail) remote ssh or console login (because they'll fail), which is probably the case unless OP didn't log off since the error. – A.B May 9 at 7:44
  • but I cant login to server, Also it is an AWS server – Abhijith May 9 at 8:21
  • @Abhijith so there's the other part in PetterH's answer: rescue boot/live image boot for rescue operations, somehow (sorry I don't know how for AWS). You should probably edit your question to state that you're (not?) logged in anymore and that it's AWS (there's even the tag amazon-web-services). – A.B May 9 at 8:41
  • Thanks guys. I was able to recover the server. I got help. – Abhijith May 9 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.