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)

4 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

3 Likes

Anybody knows if/how using credentials is possible (username and password)?

I got the mount command working, but then only see an empty folder (but with the share icon, so it is recognised as a network share in Tracker). Seems to be a security misconfig but works without problems on Linux (gotta check the config there closely now):

KERN: nfs4: NFS Error: Operation not supported
KERN: nfs4: NFS Error: Operation not allowed

I have been experiencing issues mounting nfs from haiku as well.
I was getting a permission denied.
I have traced the problem to my Virtual Machine configuration.
I am running Haiku inside VirtualBox. Its network configuration defaults to NAT.
As such, the NFS connection went through this NAT, and came from an unpriviledged port, such that the NFS server would reply permission denied.
Configuring the network adapter to Bridged mode solved the issue.

1 Like

thanks, forgot to post my update here, was also a permission issue in the end.
Quite pesky with TrueNAS and NFS permissions, but I found the right (and simple) POSIX config mix to make it work.
Additionally, there was a setting ā€œinherit permissionsā€ which I thought was more hierarchical, but it applied to new files as well. So even when permissions were corrected, I couldn’t create new files or folders…:wink:

I own a NAS Synology but I never got the ā€œmountā€ command working fine, so instead I have used ā€œmount_nfsā€.

Below are the various tests which indicates there’s no permission issue, however not sure to understand what is wrong with ā€œmountā€ or if an option/argument is not correctly used?

1 Like

Are you all connecting using credentials? If so how?

Or did you have to create a public/password-less share on you NAS?

AFAIK, NFS is not using credentials but instead IP adresses and uid/guid.
On the NAS, the list of authorized ips is available in the /etc/exports file

1 Like

If you are using the regular mount command then you must specify the filesystem type with -t nfs4. So, in your case it should be something like mount -t nfs4 -p 192.168.1.79:/volume1/documents /boot/home/NAS/documents

1 Like

Indeed with that option it’s now working fine!
Thanks :slight_smile:

1 Like

One comment on ā€œmountā€ with -t nfs4 : the performance is quite better than ā€œmount_nfsā€ which is a good news (it might be due to the nfs version used).

3 Likes

I wish the Haiku automounter would support network shares natively, this is so Linux like:(

patches welcome ducks

but seriously, we should be able to auto-discover and auto-mount shares with dns-sd, just has to be done eventually. :smiley:

1 Like

I’d love to see this Haiku style with a directory acting as the share mount having a special file type and the ā€œsharedā€ attribute as defined in BVolume and server/protocol/directory/opts as attributes.

Then the auto mounter could transparently pick this up and mount the volume using this information…:nerd_face:

The user would just have to create a new share from e.g. Tracker New templates and fill in the blanks, and be done.

1 Like