Mount NFS under Haiku

THANKS Lrrr and leavengood. The code and the entries in /var/log/syslog leaded to the solution

/var/log> tail -n5 syslog
KERN: nfs4: Error not B_OK or empty stream!
KERN: nfs4: Decode Error!
KERN: Last message repeated 2 times.
KERN: nfs4: nfs4_mount()Error mounting filesystem: Invalid Argument

The arguments looked OK and as you use the exact same syntax I checked that on another NAS in the network. It works!
Shame on me! The mistake was that the NAS protocol on the old NAS was set to NFS2/NFS3 but NFS4 was disbaled. PEBKAC!

3 Likes

I think some of the blame lies with Haiku on this one. Thatā€™s a misleading error message. Ideally it would say ā€œProtocol not supportedā€ or ā€œServer not respondingā€ or something.

1 Like

Yes we should try to improve things like that. With that said NFS4 is a pretty advanced thing to use and is also fairly new in the code. Also Iā€™m not sure if detailed errors can really be returned in something generic like fs_mount_volume which can handle any kind of file system.

This is one big downside of C style error handling. I think we have similar issues when using the pkgman utility where ā€œGeneral system errorā€ is returned many times :confused:

Error handling has been discussed pretty recently on the haiku-development mailing list but I donā€™t know if we had a clear consensus. And changing it in a big way would probably require major API breakage.

3 Likes

I wasnā€™t trying to say that the function could return a string like that. There are probably other error codes that could have been chosen, like ECONNREFUSED, EPROTO, EPROTONOSUPPORT, etcā€¦

1 Like

Yeah that would be an improvement but my comment was more about ā€œI wish we could do betterā€ than an excuse for the status quo. Probably printing out ā€œplease check the syslog for more detailā€ would help too.

just to make it clear (Iā€™ve struggled too with this command)ā€¦

if your shared folder is /srv/nfs4/my_folder on your remote system, youā€™ll need to call the mount command this way:

mount -t nfs4 -p "192.168.1.253:/my_folder" /boot/home/Desktop/mount_point

and not: mount -t nfs4 -p ā€œ192.168.1.253:/srv/nfs4/my_folderā€ etcā€¦ like you could do for scp for example (without the full path on the server, only the subfolder)

3 Likes

Iā€™m coming to this hella late, but I got my system to connect to my NAS with this syntax:

mount -t nfs4 -p 192.168.4.100:/shares/Fritz /boot/home/Desktop/Assets

My issue was the use of quotes. Iā€™m not sure why that would have been an issue, but it works like a charm.

F

2 Likes