1

I have done my search but couldn't find any answer.

After executing "rm --no-preserve-root -rf /", bash has told me things like:

  • rm: cannot remove /proc/*: Operation not permitted ...
  • rm: cannot remove /etc: Device or resource busy ...

Firstly, operation was clearly completed successfully since all files are deleted. If so why does it say such things?

Secondly, how can I still operate on my virtual CentOS machine when kernel(more like everything) is gone. Is there any kind of session that allows computer to keep operating?

Thirdly, system threw me to "/" directory in the end. When I called "ll -a", "no such file or directory". But if I call "cd /etc", bash lets me go there(!?). I even called "cd .." and got back to "/".

I assume these have something to do with hardlinks and inodes but I have yet to find any clear explanation to this.

I don't want to be a "luser"(Introduction of Linux by Machtelt Garrels P.9) who haven't seen the light :(

1
  • "Completed successully" mean the program "continued" for you? Or did you check the exit code?
    – U. Windl
    Commented Jan 4, 2022 at 15:10

1 Answer 1

5

Some files and directories aren’t deleted, for various reasons indicated by the error messages you saw. /proc contents can’t be deleted; and any busy directory can’t be deleted either. However most of your system was deleted, including all the commands in /bin, /usr/bin etc.

The system continues operating because Linux, like other Unix-style systems, keeps files and directories as long as any process has them open. Deleting a file which is in use removes it from the directory, so it’s no longer visible, but any process already using it can continue to access it.

Running ll -a will produce an error, not because there are no files, but because ls is no longer available to run. To see what files are still there, run echo *; this is handled by the shell and will continue working, as is cd which also obviously still works for you.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .