[arch-projects] [RFC][devtools][PATCH] mkarchroot: use bind mount instead of symlink for /dev/ptmx

Allan McRae allan at archlinux.org
Thu Mar 8 21:59:42 EST 2012


On 09/03/12 12:53, Allan McRae wrote:
> On 09/03/12 12:52, Allan McRae wrote:
>> On 09/03/12 12:43, Gerardo Exequiel Pozzi wrote:
>>> We need /dev/ptmx -> /dev/pts/ptmx (for devpts -o newinstance)
>>> Other way to do this thing is via bind mount (as said kernel doc[devpts.txt]).
>>>
>>> This should be done in this way at least for /dev as devtmpfs in the chroot.
>>> Since we can not touch /dev (devtmpfs), because devtmpfs is "singleton",
>>> just use bind method and avoid interference.
>>>
>>> Do it the same for both modes of /dev (tmpfs) and (devtmpfs) to keep it simple.
>>>
>>> Currently devpts in chroot is not working without this when using /dev as devtmpfs,
>>> this fixes this issue (opening /dev/ptmx, creates devices nodes on outside /dev/pts)
>>>
>>> Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
>>> ---
>>>  mkarchroot.in |    3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/mkarchroot.in b/mkarchroot.in
>>> index d45cfba..efe0398 100644
>>> --- a/mkarchroot.in
>>> +++ b/mkarchroot.in
>>> @@ -117,7 +117,7 @@ chroot_mount() {
>>>  
>>>  	[[ -e "${working_dir}/dev/pts" ]] || mkdir "${working_dir}/dev/pts"
>>>  	mount -t devpts devpts "${working_dir}/dev/pts" -o newinstance,ptmxmode=666
>>> -	ln -s pts/ptmx "${working_dir}/dev/ptmx"
>>> +	mount -o bind ${working_dir}/dev/pts/ptmx" "${working_dir}/dev/ptmx"
>>
>> Quote is missing...
> 
> ==> Creating clean working copy...done
> mount: mount point /home/arch/chroot/extra-i686/allan/dev/ptmx does not
> exist
> 

And final query...  ${working_dir}/dev/pts/ptmx is not a directory so
can you bind mount it?


>>>  	[[ -e $cache_dir ]] || mkdir -p "${cache_dir}"
>>>  	[[ -e "${working_dir}/${cache_dir}" ]] || mkdir -p "${working_dir}/${cache_dir}"
>>> @@ -148,6 +148,7 @@ copy_hostconf () {
>>>  chroot_umount () {
>>>  	umount "${working_dir}/proc"
>>>  	umount "${working_dir}/sys"
>>> +	umount "${working_dir}/dev/ptmx"
>>>  	umount "${working_dir}/dev/pts"
>>>  	umount "${working_dir}/dev/shm"
>>>  	umount "${working_dir}/dev"
>>
>>
>>
> 
> 
> 



More information about the arch-projects mailing list