3

I did this:

root# mkdir /tmp/test && mount --bind /tmp/test/ /proc/
root# rm -rf /tmp/test
root# mount -t proc proc /proc

But then I ran into this:

mount: special device proc does not exist

[root@srv ~]# umount /proc
umount: /proc: umount failed: No such file or directory
[root@srv ~]# umount /proc
umount: /proc: umount failed: No such file or directory
[root@srv ~]# mount -t proc proc /proc
mount: special device proc does not exist
[root@srv ~]# ls -al /proc
total 0

[root@srv ~]# uname -r
3.10.0-693.11.6.el7.x86_64
[root@srv ~]# mount -V
mount from util-linux 2.23.2 (libmount 2.23.0: selinux, debug, assert)
[root@srv ~]# umount -V
umount from util-linux 2.23.2 (libmount 2.23.0: selinux, debug, assert)

How can I remount /proc without restarting?

6
  • 1
    What exactly are you trying to achieve? There is no such option --bind for umount (at least not in my system). Mounting /proc usually works if I run mount -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 second proc.
    – eblock
    Oct 18, 2018 at 9:21
  • I typed a typo, sorry, changed
    – Pdogeed
    Oct 18, 2018 at 9:23
  • 1
    thank you for your answer. But I executed the three commands I described on my Linux host. All I need is to remount the proc device to /proc.
    – Pdogeed
    Oct 18, 2018 at 9:33
  • 1
    In fact, after I executed those three commands, the /proc folder is empty.
    – Pdogeed
    Oct 18, 2018 at 9:41
  • 1
    If I don't execute the rm -rf /tmp/test command, the third command will work.
    – Pdogeed
    Oct 18, 2018 at 9:45

2 Answers 2

1

What you did with the first mount is overlap the original /proc. Don't remove /tmp/test but umount it:

leap:~ # mount -o bind /tmp/test/ /proc/
leap:~ # mount |  grep proc
mount: failed to read mtab: No such file or directory
leap:~ # umount /proc
leap:~ # mount |  grep proc
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=23,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13202)

If you deleted the directory before unmounting you have to reboot, I'm not sure but I don't think you can remount /proc from that state.

3
  • 1
    Thank you for your answer. Restart can solve this problem. I want to learn how to solve it without restarting.
    – Pdogeed
    Oct 18, 2018 at 9:51
  • That's why I mentioned the umount, don't delete the directory before unmounting it.
    – eblock
    Oct 18, 2018 at 9:53
  • Haha, thank you, I am curious about the logic behind it.
    – Pdogeed
    Oct 18, 2018 at 10:01
1

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.

7
  • 1
    Thank you for your detailed answer. My environment is CentOS7 (3.10.0-693.11.6.el7.x86_64). I did have executed the three commands, but I tried to use the "umount /proc" command and the system prompts me." umount: /proc: umount failed: No such file or directory", my mount version is "mount from util-linux 2.23.2 (libmount 2.23.0: selinux, debug, assert)"
    – Pdogeed
    Oct 18, 2018 at 13:59
  • In the beginning, the pseudo file system /proc was present.
    – Pdogeed
    Oct 18, 2018 at 14:03
  • @Pdogeed wow, weird. It seemed to work for me on Fedora 28 (mount provided by util-linux version 2.32.1, kernel 4.18.10). You could double-check the error is in the umount() system call - actually probably umount2() - by running strace -f umount /proc. It sounds like you might have found a bug.
    – sourcejedi
    Oct 18, 2018 at 15:43
  • Yes, you are right. When I am in the <Ubuntu 16.04.3 LTS (4.4.0-132-generic) umount from util-linux 2.27.1 (libmount 2.27.0: selinux, assert, debug)> environment, the method you provide is feasible, I Just run umount /proc, the proc pseudo file system will automatically remount. I think this might be a bug.
    – Pdogeed
    Oct 19, 2018 at 2:05
  • Thank you again for your answer, I have solved it, recompile util-linux at Https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/…, which can be solved by compiling the generated umount /proc command.
    – Pdogeed
    Oct 19, 2018 at 2:23

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.