-1

we move the folder by mistake as

mv /usr/lib64 /usr/lib64_bck

now we try to move back as

mv /usr/lib64_bck /usr/lib64

but we get

-bash: /usr/bin/mv: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

any idea how to resolve it?

yael
  • 13,106

1 Answers1

3

You need to manually specify the dynamic loader and library path:

LD_LIBRARY_PATH=/usr/lib64_bck /usr/lib64_bck/ld-linux-x86-64.so.2 /usr/bin/mv /usr/lib64_bck /usr/lib64

The way this works is as follows. mv can no longer run on its own, because its interpreter, /lib64/ld-linux-x86-64.so.2, has disappeared (on RHEL 7, /lib64 is a symlink to /usr/lib64); so instead of running mv directly, we run the interpreter, asking it to load mv:

/usr/lib64_bck/ld-linux-x86-64.so.2 /usr/bin/mv /usr/lib64_bck /usr/lib64

This will still fail because the dynamic linker can’t find the required libraries, so we specify the updated path, resulting in the command given at the top.

See also What is /lib64/ld-linux-x86-64.so.2 and why can it be used to execute file?

Stephen Kitt
  • 434,908
  • I dont have words about how to thank you , you saved a production server , you are the best here – yael May 28 '20 at 10:32
  • Stephen Kitt , you are welcome to visit our company , how you know about where I am living ? – yael May 28 '20 at 10:34
  • @StephenKitt is it possible someway to copy the folder /usr/lib64 , from other machine , because unde r/usr/lib64 , we have some issues with some python modules – yael May 28 '20 at 10:47
  • @yael that sounds like you should ask another question with the details of the issues... – Stephen Kitt May 28 '20 at 11:11
  • @yael I can’t remember how I figured out where you are (at least, what country you’re in), perhaps from a timezone? – Stephen Kitt May 28 '20 at 12:41