-1

I have deleted an important file named ld-linux-x86-64.so.2 using rm command. So I can't execute shell commands. and I only can execute builtin commands.

Now I don't know What is should do. please help.

through this question let me say you i have busybox.

PooiaFerdowsi
  • 11
  • 1
  • 6
  • 1
    Boot Ubuntu from a live USB, and copy the file from the live USB to the appropriate location in the installed Ubuntu. – Archisman Panigrahi Nov 13 '21 at 12:45
  • Did you delete the symbolic link, or the file that it points to (something like ld-2.xx.so)? if the former, you may be able to fix it using busybox ln. Of course you'd need to be root, so it would likely involve setting init=/bin/busybox from the boot loader. – steeldriver Nov 13 '21 at 12:55
  • @steeldriver I deleted the file /usr/lib64/ld-linux-x86-64.so.2. is it the symbolic link or main file? – PooiaFerdowsi Nov 13 '21 at 13:08
  • @ArchismanPanigrahi I can't because the softwares needed for are unavailable due the file deletion – PooiaFerdowsi Nov 13 '21 at 13:20
  • Use someone else's computer to create the live USB. It is a good idea to create and safely store a live DVD of Ubuntu, for extreme cases like this, – Archisman Panigrahi Nov 13 '21 at 13:34
  • Could try to use extundelete: https://askubuntu.com/a/317955/20054. – mikewhatever Nov 13 '21 at 13:39
  • @mikewhatever i can't use apt – PooiaFerdowsi Nov 13 '21 at 13:42
  • Well, obviously, you'll need another system, even something from USB or similar. – mikewhatever Nov 13 '21 at 13:49
  • @PooiaFerdowsi it looks like you deleted the symlink. Here is an answer that describes how to use init=/bin/busybox sh to get a statically-linked root shell (in that case, to fix a deleted libc.so.6). From there you should be able to use busybox's statically linked ln command to recreate the link. If you need futher help please [edit] your question to include your complete Ubuntu version information. – steeldriver Nov 13 '21 at 14:27

1 Answers1

1

I encountered the same problem and finally managed to solve the problem without booting from USB or another. The machine is a Linux machine on AWS.

Run the following command to recreate the symbolic link file ld-linux-x86-64.so.2

(You may need to change the version number 2.31, you can autocomplete it by pressing tab)

/lib/x86_64-linux-gnu/ld-2.31.so /bin/ln -s /lib/x86_64-linux-gnu/ld-2.31.so /lib64/ld-linux-x86-64.so.2
Cactus
  • 11
  • 1