Let’s first not talk about why this can happen, but deleting /lib
, /usr/lib
, or some other essential runtime files happens quite a lot (as you can see: here, here, here, and here). In this post, I will only discuss what happens when you delete /lib
on Linux and how to recover from that.
The easy solution for everything is to replace the missing files, but this can be difficult if /lib
is deleted because we won’t have ld-linux
, which is needed to run any dynamic executable. When you deleted /lib
, all non-static executable (such as ls
, cat
, etc
, will output):
No such file or directory
You will also be unable to open any new connection using ssh, or open a new tmux window/pane if you are using tmux. So you can only rely on your current shell built in, and some static executables that you have on the system.
If you have a static busybox
installed, then it can be your rescue. You can use wget
from busybox
to download libraries from a clean system. For your information: Debian has busybox
installed by default, but the default is not the static version.
If you are worried that this kind of problem might happen to you in the future: Install the static version of the busybox binary, and confirm that it is the correct version.
Continue reading “When you deleted /lib on Linux while still connected via ssh”