sjiveson / nfs-server-alpine

A handy Alpine Linux based NFS Server image running NFS v4 only, over TCP on port 2049
https://hub.docker.com/r/itsthenetwork/nfs-server-alpine/
GNU General Public License v3.0
295 stars 187 forks source link

Startup takes quite a while (IPv6 issue?) #4

Closed WIStudent closed 6 years ago

WIStudent commented 6 years ago

Hi, I noticed that the startup takes quite a while:

2018-01-02T15:14:28.448553150Z  Starting NFS in the background...
2018-01-02T15:14:28.452406602Z  rpc.nfsd: knfsd is currently down
2018-01-02T15:14:28.452425323Z  rpc.nfsd: Writing version string to kernel: -2 -3 +4
2018-01-02T15:14:28.452428157Z  rpc.nfsd: Created AF_INET TCP socket.
2018-01-02T15:17:37.771778045Z  rpc.nfsd: Created AF_INET6 TCP socket.
2018-01-02T15:17:37.774152827Z  Exporting File System...
2018-01-02T15:17:37.774663674Z  exporting *:/nfsshare
2018-01-02T15:17:37.777056127Z  Starting Mountd in the background...

Actually the only thing that needs so much time seems to be the creation of an AF_INET6 TCP socket. On my machine it always takes about 189 seconds. Do you have an idea what the issue could be? It has probably something to do with IPv6 but giving the container an IPv6 address didn't help in my case.

sjiveson commented 6 years ago

I've not seen this issue on Ubuntu 17 or Fedora 16 or 17 (variously on a Pi, an Intel core i5 and i7). I suspect you have IPv6 disabled in some way (but not completely) at an OS level and it's causing issues. It's a bit of a nightmare in most cases when you try to 'kill' IPv6. There's no specific NFS setting related to the underlying network protocol so there's no anything I believe I can do to help with this. If you disagree, let me know.

sjiveson commented 6 years ago

Bar telling you to disable IPv6 I think your only option is perhaps to not use --net=host and map the port specifying only an IPv4 address -p x.x.x.x:2049:2049. Perhaps also throw in --ipv6=false.

I'm not convinced that will work so perhaps you could disable IPv6 in the container OS itself by adding this to your run command: --sysctl net.ipv6.conf.all.disable_ipv6=1. I'll hopefully have a go myself soon.

n3v3rf411 commented 6 years ago

I'm also experiencing this.

Probably related to this one: https://www.spinics.net/lists/linux-nfs/msg59728.html

n3v3rf411 commented 6 years ago

Starting rpcbind (uncommenting the code in nfsd.sh) seems to do the trick

sjiveson commented 6 years ago

Thank you for your valuable input Willie! I'll get this sorted today and try to remember to check if its still a problem at some point in the future.

sjiveson commented 6 years ago

OK, rpcbind enabled and latest updated plus tag 7 created.