winnfsd / winnfsd

455 stars 112 forks source link

Cannot Start NFS Daemon #72

Open ihmcjacky opened 5 years ago

ihmcjacky commented 5 years ago

Facing a quite weird situation, the NFS daemon cannot be started. However it can be started at Windows safe mode. I am wondering if other programs are occupying the port but can't find any, and I also tried to turn off the firewall.

Any help would be appreciated

OS: Windows 10 Pro 1809 64 bit

...
Path #22 is: S:\Blu-ray, path alias is: /S/Blu-ray
Path #23 is: T:\Blu-ray, path alias is: /T/Blu-ray
Path #24 is: Z:\Blu-ray, path alias is: /Z/Blu-ray
Portmap daemon started
NFS daemon starts failed.

Looking at the source code, seems the socket with port 1058 cannot be created... But I can't find further clues for the initialization failure

vctls commented 5 years ago

I'm getting the same error. Same OS version. I haven't used WinNFSD for a few months on this computer but I'm pretty sure it worked. Port 1058 is unused. Just to be sure there's nothing blocking it, I ran an http server on it, without any problem. I have yet to try in safe mode.

vctls commented 5 years ago

I think I managed to narrow it down to one service: HNS or Host Networking Service
I disabled it in msconfig, and winnfsd is working again.
Also, manually stopping the service and starting it again seems to work.

Bad news is: this service might be necessary for virtual networking.
I'm not sure it's the service in itself. It might be something else related to Docker or Hyper-V.

sdespont commented 5 years ago

@vctls Did you try to use another port? The MOUNT_PORT should be an option in config, but as test, a new build should not be very complicated.

@marcharding What tool are you using to compile this code? Visual Studio C++?

https://github.com/winnfsd/winnfsd/blob/d833130fab6ed1fcf7fe89ecc628ad1fdf464c86/src/winnfsd.cpp#L15-L20

vctls commented 5 years ago

@sdespont I'm not sure it is a port issue. Or at least, not with the mount port. I tried running something else on that port and it worked fine.
Yeah, it would be nice if that was a configurable parameter. More verbosity could be useful, too.

sdespont commented 5 years ago

@vctls In that case, you should try to download Visual Studio Community then compile the project in debug mode and find where the bug is. It should not be complicated because your problem occurs at the start of the application and is not due to some complex multithreading issues.

I am sure that the line pointed by the debugger where the error occurs will be very useful to figure it out.

And sorry, but I can't help you because I am using Windows 8.1 x64 and it works every days like a charm for more than 1 year. Even sleep feature of the laptop is working very well.

eXtreme commented 4 years ago

Do you have Hyper-V installed? Because I've been fighting with this problem for long and recently, finally found a permanent solution for that:

https://github.com/docker/for-win/issues/3171#issuecomment-554587817

cc @vctls because you are mentioning HNS which was partially reponsible for that. The main reason is explained in the linked comment.

vctls commented 4 years ago

I do have Hyper-V, since I'm using WinNFSd to share files with Docker projects. But I've been using this setup for months without issues now. And I just checked HNS and it's currently active. There have been quite a lot of Windows updates since, though.

Thanks for reminding me of this issue. Some of my colleagues have been struggling to make Docker and WinNFSd work on their workstation, and I didn't think of checking this.

2020-10 update: I have abandoned nfs since Docker for Windows 2.3 greatly improved native bind-mount performance.

Jurigag commented 3 years ago

If someone will look in future for this it's most likely that HNS reserves port used for nfs, there is way to solve this - https://github.com/docker/for-win/issues/3171#issuecomment-554587817