Skip to content

Cannot connect/mount to a new NFS Server where the logs say it's all ok #89

@Danilo-Araujo-Silva

Description

@Danilo-Araujo-Silva

Unfortunately, I'm not being able to connect/mount the server and I'd like to request some help.
I'm currently using Windows 11 with Ubuntu 22.04.3 LTS on WSL.

I've created the container with this command:

clear

docker rm -f nfs

# -e NFS_DISABLE_VERSION_3=true \

docker run \
	--name nfs \
	--network host \
	-v /media/shared:/media/shared \
	-v /lib/modules:/lib/modules:ro \
	-e NFS_EXPORT_0='/media/shared *(rw,sync,no_subtree_check)' \
	-e NFS_LOG_LEVEL='DEBUG' \
	--privileged \
	--cap-add SYS_ADMIN \
	--cap-add SYS_MODULE \
	erichough/nfs-server

#docker run \
#	--name nfs \
#	--network bridge \
#	-v /media/shared:/media/shared \
#	-v /lib/modules:/lib/modules:ro \
#	-e NFS_EXPORT_0='/media/shared *(rw,sync,no_subtree_check)' \
#	-e NFS_LOG_LEVEL='DEBUG' \
#	--privileged \
#	--cap-add SYS_ADMIN \
#	--cap-add SYS_MODULE \
#	-p 50111:111/tcp \
#	-p 50111:111/udp \
#	-p 50049:2049/tcp \
#	-p 50049:2049/udp \
#	-p 52765:32765/tcp \
#	-p 52765:32765/udp \
#	erichough/nfs-server

where I have also tried to create it in bridge mode as well as we can see above.

The logs say everything should be ok

==================================================================
      SETTING UP ...
==================================================================
----> log level set to DEBUG
----> will use 32 rpc.nfsd server thread(s) (1 thread per CPU)
----> building /etc/exports from environment variables
----> collected 1 valid export(s) from NFS_EXPORT_* environment variables
----> kernel module nfs is loaded
----> kernel module nfsd is loaded
----> setup complete

==================================================================
      STARTING SERVICES ...
==================================================================
----> mounting rpc_pipefs filesystem onto /var/lib/nfs/rpc_pipefs
mount: mount('rpc_pipefs','/var/lib/nfs/rpc_pipefs','rpc_pipefs',0x00008000,'(null)'):0
----> mounting nfsd filesystem onto /proc/fs/nfsd
mount: mount('nfsd','/proc/fs/nfsd','nfsd',0x00008000,'(null)'):0
----> starting rpcbind
----> starting exportfs
exporting *:/media/shared
----> starting rpc.mountd on port 32767
----> starting rpc.statd on port 32765 (outgoing from port 32766)
----> starting rpc.nfsd on port 2049 with 32 server thread(s)
rpc.nfsd: knfsd is currently down
rpc.nfsd: Writing version string to kernel: -2 +3 +4 +4.1 +4.2
rpc.nfsd: Created AF_INET TCP socket.
rpc.nfsd: Created AF_INET UDP socket.
rpc.nfsd: Created AF_INET6 TCP socket.
rpc.nfsd: Created AF_INET6 UDP socket.
Statd service already running!
----> all services started normally

==================================================================
      SERVER STARTUP COMPLETE
==================================================================
----> list of enabled NFS protocol versions: 4.2, 4.1, 4, 3
----> list of container exports:
---->   /media/shared   *(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,root_squash,no_all_squash)
----> list of container ports that should be exposed:
---->   111 (TCP and UDP)
---->   2049 (TCP and UDP)
---->   32765 (TCP and UDP)
---->   32767 (TCP and UDP)

From inside the container I have:

bash-5.0# clear && netstat -tulnp | grep LISTEN && exportfs && cat /media/shared/test.txt && ps aux | grep rpc && showmount -e localhost

bash-5.0#
tcp        0      0 0.0.0.0:32767           0.0.0.0:*               LISTEN      44/rpc.mountd
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:39319           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:53317           0.0.0.0:*               LISTEN      -
tcp        0      0 :::60727                :::*                    LISTEN      -
tcp        0      0 :::36109                :::*                    LISTEN      -
tcp        0      0 :::32767                :::*                    LISTEN      44/rpc.mountd
tcp        0      0 :::2049                 :::*                    LISTEN      -
tcp        0      0 :::111                  :::*                    LISTEN      -
/media/shared   <world>
This text is inside the file.

   40 daemon    0:00 /sbin/rpcbind -s
   44 root      0:00 /usr/sbin/rpc.mountd --port 32767 --nfs-version 4.2 --no-nfs-version 2 --debug all
  103 root      0:00 grep rpc
clnt_create: RPC: Program not registered

But from outside the container I'm not being able to do anything useful yet (none of the commands below work, they are stuck, waiting for something, but cannot perform the task)

sudo mount -t nfs -o vers=4 localhost:/media/shared /mnt/nfs

showmount -e localhost

nc -zv localhost 2049

What can I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions