Re: pivot_root.2: new_root must be a mountpoint
From: Michael Kerrisk (man-pages) <hidden>
Date: 2019-09-19 06:34:55
From: Michael Kerrisk (man-pages) <hidden>
Date: 2019-09-19 06:34:55
Hello Yang Bo, On 9/19/19 4:38 AM, Yang Bo wrote:
The man page says that new_root does not have be a mountpoint but it must be, I tried to pivot_root into a non-mountpoint directory and always failed with EINVAL, the kernel source fs/namespace.c confirms that, to quote a comment from this file: - it's okay to pick a root that isn't the root of a file system, e.g. - /nfs/my_root where /nfs is the mount point. It must be a mountpoint, - though, so you may need to say mount --bind /nfs/my_root /nfs/my_root - first.
Yes, you are correct. There are in fact many problems in the current pivot_root(2) page, and I am in the process of substantially revising it. Thanks Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/