NFS compatibility kodi/libnfs

Hi,

I am running Ipfire latest core 169. I have a kodi running on the network and before upgrade to 169 (I was at core 167) I could access my NFS from within Kodi without any trouble.
Now Kodi cannot read the NFS anymore. It freezes. I read that kodi uses libnfs so I tries to install libnfs with pip and try a dummy listdir of the nfs from the green network of Ipfire (port 2049 and 111 are opened even if I know NFSv4 only need 2049).

Unfortunately this test script which is just open nfs to create a context and list dir does not work.

I wonder what could be the probleme. I read on the xmbc github that kernel 5.10 had a regression issue regarding NFS but Ipifre is 5.15.

Fun fact, from my ubuntu on which I run the test script, with the mount in the fstab, I can access the nfs. So it’s like the NFS in linux kernel is no more compatible with libnfs ? Is that possible in some way ?

This is problematic since in CoreElec for instance, I dont see any fstab file. A long time ago, I used to configure NFS in fstab and configure kodi to access local folder. But I found it convenient to use the nfs support of kodi directly.

Any hint/help/suggestion/idea is welcome !

Thanks
Jordan

On the machine that is running kodi, what do the logs show when you try to access the nfs on IPFire.

Thanks Adolf,

Well there is no error, it just hangs.
If I use the python libnfs it hangs too. I have to kill the script with Ctrl+D
Could it be a port issue ? How can I investigate ? I don’t see any drop in the firewall log regarding my IP address.

Could it be relates to Unable to play some media under kernel 5.10.11 when using NFS · Issue #19147 · xbmc/xbmc · GitHub ? To mountd ? To portmapper ?

Thx

I don’t think so as that bug was fixed in kernel 5.10.15 and currently IPFire is on kernel 5.15.49 so way after that fix was implemented.

nfs was updated from 2.5.3 to 2.6.1 in Core Update 168. Maybe some form of issue occurred between nfs and kodi in the update from 2.5.3 to 2.6.1

What version of kodi are you using.

As there is no log info at all then your best bet might be to raise the issue at either the kodi or nfs websites.

I don’t use kodi myself so can’t help with any experience on that tool.
I use nfs on my desktop linux system and that is at version 2.6.1 but I am not having any problems with that at all.

If you try and access the IPFire nfs share with an nfs client on the computer running Kodi, does that work successfully? If yes then I would suggest raising the issue at Kodi. If not then what errors does the nfs client get in the logs.

Ok I’ll ask the kodi team.

So you say ipfire uses libnfs 2.6.1 but ubuntu 22.04 has libnfs 4.0.0 and on Tags · sahlberg/libnfs · GitHub the latest version is 5.0.1

It is the same libnfs ? Because 2.6.1 would be like very old and I don’t think you use old libraries …

Is there a way to downgrade ipfire nfs to 2.5.3 ? just for testing purpose ?

Yes ubuntu (22.04) can access the ipfire nfs with the mount set in the fstab or using mount.
But on the same ubuntu launching kodi, nfs does not work inside and makes Kodi hangs forever.

Edit: I see NFS: add preliminary nfs4 support by lrusak · Pull Request #21659 · xbmc/xbmc · GitHub that nfsv4 is not implemented in kodi. Although I tried to add the ?version=4 at the end of the uri it does not work. Is there something related to nfsv3 in nfs 2.6.1 compared to 2.5.3 ?

Sorry. My fault. I didn’t make it clear enough.

IPFire uses nfs-utils which provides both server and client options within it.
This is currently at version 2.6.1

This uses the library libnfsidmap.so.1.0.0

libnfs is a client only package to access nfs shares. It does not exist on IPFire but your Ubuntu client computer can use that software to access the nfs shares that the IPFire nfs server runs.

Unfortunately not. Even going back and installing CU167 won’t work as the addons always only have the most recent version. There are no multiple versions of addons. So re-installing CU167 and then installing nfs will still give you version 2.6.1

The only way to get version 2.5.3 would be to do a build of the addon yourself. Feasible to do but it is a bit of work.
https://wiki.ipfire.org/devel/ipfire-2-x/build-howto
https://wiki.ipfire.org/devel/ipfire-2-x/addon-howto

In version nfs-utils-2.6.1 version nfsv2 has been removed from being used.
nfsv4 was already available in version 2.5.4 and 2.6.1 but there were some bug fixes for it.
nfsv3 is not mentioned in the changelog for the update to 2.6.1 at all.
See this link https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=a2a05a470649a6ade7d00d82436c2834ababe7ab for the changelog details.
Reading the man page for nfs then if you have not specified in the server conf file a specific version number or range then the client will negotiate the highest possible version number between the two. So if Kodi is limited to v3 then the IPFire nfs server would be expected to accept that as the highest version.
If you had specified v3 then that should still be okay because Kodi would start with that version level.

EDIT::
Is your Kodi set up to use nfsv3 or nfsv2. If nfsv2 then the change to 2.6.1 will cause a problem as nfsv2 is no longer supported , only nfsv3 and nfsv4

Thanks you for detailed reply.

I dig a litlle bit on my side and here is what I can say:

Test case 1:
Ubuntu 22.04LTS 192.168.0.7/24 (which uses the same lib as ipfire according to apt show nfs-common: libnfsidmap1 (= 1:2.6.1-1ubuntu1)) with nfs-kernel-server installed and Ubuntu 22.04LTS 192.168.0.15/24 with nfs-common and kodi 19 everything works: kodi can read NFS and ubuntu client too.

Test case 2:
Ipfire with nfs 2.6.1, same export as ubuntu server.
Ubuntu 20.04 on green network NFS OK but kodi 18.4 cannot read NFS
Ubuntu 22.04 on openvpn network with full access to firewall green interface (I know I know …) NFS Ok but kodi 19 cannot read NFS (I tried a home wifi and 4G) and openvpn client has green access in the configuration of openvpn roadwarrior

I am a bit confused nfs 2.6.1 is not the problem since it works in test case 1.
Why with ipfire and full green access it would not work ? Or why even in the Green network (which has full access to ipfire green interface right ?) it does not work (ok that’s an older version of kodi…but still).

Kodi does not seem to be the problem (no nfsv2 btw). The “hang” or 'freeze" seems to be a firewall issue to me, doesn’t it ?

Maybe I am driving myself crazy :rofl:

I do not understand, is Kodi on an OpenVPN machine or it is on green? Keep in mind that OpenVPN has no TAP interface in IPFire therefore it can’t receive Avahi/zerconf traffic. I think kodi uses avahi to detect the shares. Probably you can still mount the share but you need to specifically create a link to it.

I tried both. From green network and from OpenVPN. As I said. It used to work :frowning:
I am not familiar with avahi/zeroconf so I may say something dumb but I don’t want kodi to discover the NFS, I write the correct URI and Kodi browse the NFS to find medias. It worked with core 167.

Did you try to recreate the URI instead of trying the one you created in the past? Is it possible that the URI served by IPFire has changed after the update?

probably I was the one saying something dumb, I do not think IPFire uses avahi.

EDIT: yes I said something dumb indeed, avahi must be installed with pakfire.

Yes, the ubuntu 22.04 client over VPN is fresh new and 20.04 as well

How could I watch all the incoming traffic from a given ip on ipfire ?
So that I can try to monitor if something is coming on from the kodi nfs client

Edit: Maybe I could try to make a virtual environment with IPfire and a green interface to simulate the situation and see with the problem exists with a fresh new installation ?!

You need a console access to IPFire. After the login:

tail -f /var/log/messages

ctrl-c to exit.

Is it possible that your problem is due to the use of unprivileged ports (ie > 1023)? See the troubleshooting part of kodi wiki concerning NFS shares: https://kodi.wiki/view/NFS, in particular the use of the “unprivileged” option in the share.

I got it you might be right. Here is the message :frowning:

Aug  2 18:17:32 XXXXX rpc.mountd[3004]: refused mount request from 192.168.XX.YY for /media/nfs (/media/nfs): illegal port 52424

To solve the problem you should modify /etc/exports to add the insecure switch to the list of options.

You are totaly right, it works now for my ubuntus on green and OpenVPN excet on my “real” kodi on odroid device. I suspect an addon update screwing everything up…

I see

Aug  2 18:44:41 XXX rpc.mountd[3004]: authenticated mount request from 10.XX.YY.ZZ:681 for /media/nfs/foo (/media/nfs)

but nothing happens on kodi.

Strange, from the log it looks like kodi tried to use port 681, while it should use an insecure port. The entire issue is due to the use of ports > 1023 from kodi. Then why kodi on odroid is using a port below 1023?

EDIT: does kodi on the odroid run as root?

Quote:

ROOT vs NON-ROOT
================
When running as root, libnfs tries to allocate a system port for its connection
to the NFS server. When running as non-root it will use a normal
ephemeral port.
Many NFS servers default to a mode where they do not allow non-system
ports from connecting.
These servers require you use the "insecure" export option in /etc/exports
in order to allow libnfs clients to be able to connect.

I have no clue but I would say yes since when I ssh to coreelec I am root.
Since I use de insecure option, It should work with any port < 1024 or > 1023 shouldn’t it ?

I don’t know. I think I have something going wrong with the installation which is 3 or 4 years old. Maybe some garbage took place :smile: