I did a rm -r /bin!
Apr 08, 2015
How I used Docker to bring back some of my binaries.
I just did something really stupid:
I know, I know… I shouldn’t have done that, but I assure you, that wasn’t my intention.
I just wanted to remove a local bin/
folder, which happened to be created by a
root process, but you know, sometimes we just type a backslash in the wrong place.
I was surprised when I tried to check if the folder was deleted:
WHAT??? No ls
?? Soon enough I realized what I have done.
It’s not like
doing a sudo rm -rf /
, not even like doing a
rm -rf /usr,
but I admit I panicked a little. After some time thinking what to do next,
I typed in the command docker
, which I use a lot, and it was working.
Sure enough, it’s a daemon process and it’s not even located at bin
.
Then came in a brilliant idea.
As I’m running Ubuntu 14.04, I could just run a Ubuntu container and copy it’s /bin
folder to my machine. To
do that I just had to mount my host /bin
somewhere inside the container. I choose
to mount it at /temp_bin
(yeah, I’m that creative!).
So, the whole thing I did was:
And now I have back at least some of my precious programs:
As a final tip, I had to reinstall some deleted packages that apt thinks are still
around. To force a reinstallation of package nano
, for example, I just did:
Written by Allan Costa