0

I don't know why mount caused some files in /usr/bin to be removed. It's made everything out of control:

it happened after mount --rbind /dev /home/binex

I also trying umount but it says -bash: umount: command not found

What can I do to recover this thing? I can't ls, cat, but I can cd to any dir, and also I can use TAB in any place to display all things, and I don't know why everything is showing up here:

help

1

I don't ask you why do you do this, but I can explain this issue.

When you mount /bin to /home/binex then you have /bin directory in /home/binex too and from file system point it's the same directories. Next, when you mount /dev to /home/binex you definitely mount /dev to /bin, because /home/binex and /bin mount points (after first mount command) is equal mount points and they point to one directory. Therefore you overlap your /bin and can't access to mount command.

So, files are not being removed. They are being overlapped. Reboot will fix this.

0

Specifically, this is a consequence of mount propagation.

Modern systems, including anything which boots with systemd, enable mount propagation on / and child mounts by default. It is recommended generally, for the benefit of mount namespaces.

This means that when you create a bind mount, by default any mount operations you make underneath the bind mount are also applied to the source directory. (More usefully, the propagation also works the other way round).

If you have the misfortune to not know about this and end up over-mounting /bin (which I'm guessing is a symlink to /usr/bin) with something else, you won't be able to access your normal commands. Ouch.

If you want to find out a bit more about the effect of mount propagation, you could start by skimming through man mount. It references some other documents as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.