Mistakenly ran rm /*
as root
.
In result, it did remove all files from linux root dir, but preserved folders. (which is good news)
lrwxrwxrwx 1 root root 7 Aug 5 2020 bin -> usr/bin
lrwxrwxrwx 1 root root 7 Aug 5 2020 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Aug 5 2020 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 Aug 5 2020 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 Aug 5 2020 libx32 -> usr/libx32
lrwxrwxrwx 1 root root 8 Aug 5 2020 sbin -> usr/sbin
Because in Ubuntu 22.04 /bin is symlink to /usr/bin, it was also removed.
So if i try to run any command via bash, it fails due error:
If i will try to use /usr/bin/bash, it fails:
# /usr/bin/bash
bash: /usr/bin/bash: No such file or directory
But file does exist:
/usr/bin/bash/
bash: /usr/bin/bash/: Not a directory
# /usr/bin/bas
base32 base64 basename basenc bash bashbug
It seems, that main issue is that current bash tries to run use /bin/bash
in order to run commands:
# ldd ls
bash: /usr/bin/ldd: /bin/bash: bad interpreter: No such file or directory
It seems, that bash tries to execute command via /bin/bash
interpreter, but fails because this symlink is gone.
Saw answer https://askubuntu.com/a/906692, but fails on first steps:
#sudo /proc/$$/exe
bash: /usr/bin/sudo: No such file or directory
or
/proc/$$/exe
bash: /proc/1872780/exe: No such file or directory
Again, due issue with /bin/bash: bad interpreter
Is there any way to run command in bash using different interpreter or change interpreter path somehow?
Shebangs doesn't seems to work, or may be i'm using them wrong.
Also, i understand that it's possible to restore using liveCD, but it's remote system, and i can't get to it for another month.