To avoid this error message, you need to run another command first:
root# mkdir /tmp/test && mount --bind /tmp/test/ /proc/
root# rm -rf /tmp/test
root# umount /proc/
root# mount -t proc proc /proc
But you probably started with the proc
psuedo-filesystem mounted on /proc
. In that case, the last command will show a new message:
mount: /proc: proc already mounted on /proc
You could avoid the new error message if you run umount /proc/
twice, before trying to mount it again. However you don't say any reason why you want to do that :-). Probably you only want to run the first three commands above :-). Then you can continue using the /proc
filesystem as usual.
You are not allowed to run the commands you tried (on Linux). The reason is that after you delete a directory, you are not allowed to use it as a directory. When you try to use a deleted directory, Linux returns the error code ENOENT
. The description for this error code is "No such file or directory".
Technically the error code is confusing, because the directory technically still exists. But it fits better than any of the other error codes :-).
# mkdir dir
# cd dir
# rmdir ../dir
# mkdir subdir
mkdir: cannot create directory ‘subdir’: No such file or directory
Similarly, you are not allowed to mount a filesystem on top of a deleted directory.
# mount --bind /proc .
mount: .: mount(2) system call failed: No such file or directory.
I say that the directory technically still exists, because it still has an inode number (and the inode still stores a time stamp, and a permission mode, etc):
# ls -l -i -d .
5521426 drwxr-xr-x. 0 root root 0 Oct 18 13:09 .
# chmod a-x .
# ls -l -d .
drw-r--r--. 0 root root 0 Oct 18 13:09 .
Your mount
command did not print the generic description of the error code: "No such file or directory". The mount
program tries to guess exactly what could have caused the error code. Unfortunately, this means it sometimes guesses wrong :-). There was no problem with "the special device proc". The problem was the mount point /proc
.
--bind
for umount (at least not in my system). Mounting /proc usually works if I runmount -t proc /proc <MOUNTPOINT>
, e.g. in rescue mode when I have to chroot into a system. So in this case you would be missing a/
in front of the secondproc
.