Warning⚠

If you run sudo rm -rf /* directly,DON’T ASK ME why the system isn’t start.If you are curious in that,you can download a VM and run it in the VM. I promise after running,your system won’t work properly! img1

root@h1:/# id -un
root
root@h1:/# rm -rf /*
rm: cannot remove '/boot/efi': Device or resource busy
rm: cannot remove '/dev/mqueue': Device or resource busy
rm: cannot remove '/dev/hugepages': Device or resource busy
rm: cannot remove '/dev/pts/1': Operation not permitted
...<snip>...
rm: cannot remove '/proc/63/mountstats': Operation not permitted
rm: cannot remove '/proc/63/clear_refs': Operation not permitted
^CError
root@h1:/# 
root@h1:/# ls
bash: /usr/bin/ls: No such file or directory
Error: Connection got lost
Reconnecting...fail
Reconnecting...fail
Reconnecting...fail
Reconnecting...fail
Error: can not connect.Connection closed.
% 

Why it works:

root# rm -rf /*
=
root# rm -rf /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /misc /mnt /net /nfs /opt /proc /root /run /sbin /srv /sys /tmp /usr /var

Why rm -rf / don’t work

execve("/usr/bin/rm", ["rm", "-rf", "/"], 0x7ffde6de8960 /* 43 vars */) = 0
brk(NULL)                               = 0x558b0cb0f000
...<snip>...
lstat("/", {st_mode=S_IFDIR|0555, st_size=224, ...}) = 0    // PLEASE NOTE THIS LINE
newfstatat(AT_FDCWD, "/", {st_mode=S_IFDIR|0555, st_size=224, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
...<snip>...
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "rm: ", 4rm: )                     = 4
write(2, "it is dangerous to operate recur"..., 45it is dangerous to operate recursively on '/') = 45   // PLEASE NOTE THIS LINE TOO
write(2, "\n", 1
)                       = 1
write(2, "rm: ", 4rm: )                     = 4
write(2, "use --no-preserve-root to overri"..., 48use --no-preserve-root to override this failsafe) = 48
write(2, "\n", 1
)                       = 1
lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
close(0)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

/* coreutils-8.30/lib/root-dev-ino.c */
LN
25  /* Call lstat to get the device and inode numbers for '/'.
26     Upon failure, return NULL.  Otherwise, set the members of
27     *ROOT_D_I accordingly and return ROOT_D_I.  */
28  struct dev_ino *
29  get_root_dev_ino (struct dev_ino *root_d_i)
30  {
31    struct stat statbuf;
32    if (lstat ("/", &statbuf))      // HERE,CALLED SAME AT THE TOP
33      return NULL;
34    root_d_i->st_ino = statbuf.st_ino;
35    root_d_i->st_dev = statbuf.st_dev;
36    return root_d_i;
37  }

—SO NEVER TRY…

sudo rm -rf /*