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!


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.


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 "" /boot/home/Desktop/mount_point

and not: mount -t nfs4 -p “” etc… like you could do for scp for example (without the full path on the server, only the subfolder)


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

mount -t nfs4 -p /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.