Kodi Community Forum

Full Version: NFS fails to connect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

My NFS source in XBMC 13.0 recently stopped working. I'm not positive what caused it, I tried downgrading libnfs and the linux kernel to back a few months to when I'm certain it was working, but with no success. I also tried downgrading XBMC to 12.3 also without any success.

Mounting my NFS share still works fine using nfsutils with `mount -t nfs desktop:/home/evan/documents/multimedia ~/some-folder`

Here is my full xbmc.log

This is the relevant section:

02:43:48 T:139805856254016   DEBUG: CGUIMediaWindow::GetDirectory (nfs://desktop/home/evan/documents/multimedia/)
02:43:48 T:139805856254016   DEBUG:   ParentPath = [sources://video/]
02:43:49 T:139805856254016   DEBUG: ------ Window Init (DialogBusy.xml) ------
02:43:49 T:139805856254016   DEBUG: Joystick 0 button 1 Up
02:43:49 T:139804569323264   DEBUG: SECTION:LoadDLL(libnfs.so.4)
02:43:49 T:139804569323264   DEBUG: Loading: libnfs.so.4
02:43:49 T:139804569323264   DEBUG: NFS: Context for desktop/home/evan/documents/multimedia not open - get a new context.
02:43:50 T:139804569323264   DEBUG: NFS: Connected to server desktop and export /home/evan/documents/multimedia
02:43:50 T:139804569323264   DEBUG: NFS: chunks: r/w 1048576/1048576
02:43:50 T:139804569323264   ERROR: Failed to open(//) nfs_opendir_async failed
02:43:50 T:139805856254016   ERROR: GetDirectory - Error getting nfs://desktop/home/evan/documents/multimedia/
02:43:50 T:139805856254016   ERROR: CGUIMediaWindow::GetDirectory(nfs://desktop/home/evan/documents/multimedia/) failed
02:43:50 T:139805856254016   DEBUG: CGUIMediaWindow::GetDirectory (sources://video/)

And here's what I see in my journal on the server:

$ sudo journalctl -b /usr/bin/rpc.mountd
-- Logs begin at Thu 2013-10-31 17:51:46 EDT, end at Tue 2014-05-27 23:23:24 EDT. --
May 25 02:59:08 desktop rpc.mountd[339]: Version 1.2.9 starting
May 26 02:29:44 desktop rpc.mountd[339]: authenticated mount request from for /home/evan/documents/multimedia (/home/evan/documents/multimedia)
May 26 02:43:49 desktop rpc.mountd[339]: authenticated mount request from for /home/evan/documents/multimedia (/home/evan/documents/multimedia)

I had a similar problem about a year ago that turned out to be a bug in libnfs that I was able to work around by downgrading the kernel. But again, that doesn't seem to be working this time around.

I'm on Arch Linux

$ uname -a
Linux htpc 3.14.4-1-ARCH #1 SMP PREEMPT Tue May 13 16:41:39 CEST 2014 x86_64 GNU/Linux

Also my /etc/exports file:

# Share media with my HTPC

Is anyone currently successfully using NFS with their arch XBMC setup? Any ideas?
I've got a couple of questions:
  • When XBMC gives you the error, can you do an 'ls' on the NFS mount point? Does it display the correct content?
  • Have you tried mounting the NFS share via fstab and configure XBMC to just access the directory as local?

In my case I'm not too far from your setup, I use a Samba share mounted as a local folder using SMB/CIFS from the kernel itself. The only issue I have right now is that if I suspend and wake my HTPC, sometimes I loose the mountpoint and the local directory is empty, so I need to remount it.
(2014-05-28, 10:25)silmano Wrote: [ -> ]When XBMC gives you the error, can you do an 'ls' on the NFS mount point? Does it display the correct content?

XBMC is using libnfs internally so there is no mount point on the system.

(2014-05-28, 10:25)silmano Wrote: [ -> ]Have you tried mounting the NFS share via fstab and configure XBMC to just access the directory as local?

Yeah, I can have the NFS export mounted to my system (either automatically using fstab, or manually using `mount -t nfs`) and XBMC can see the directory fine. This is my work around right now, but it's definitely not ideal and only temporary since my entire library is mapped to `nfs://desktop/home/evan/documents/multimedia/...`.
I gave the latest git version of libnfs a try, which seems to make things worse, since now it's just a generic error:

02:03:31 T:140644474386496   DEBUG: CGUIMediaWindow::GetDirectory (nfs://desktop/home/evan/documents/multimedia/)
02:03:31 T:140644474386496   DEBUG:   ParentPath = [sources://video/]
02:03:31 T:140644474386496   DEBUG: ------ Window Init (DialogBusy.xml) ------
02:03:31 T:140644474386496   DEBUG: Joystick 0 button 1 Up
02:03:32 T:140643021190912   DEBUG: SECTION:LoadDLL(libnfs.so.4)
02:03:32 T:140643021190912   DEBUG: Loading: libnfs.so.4
02:03:32 T:140644474386496   ERROR: GetDirectory - Error getting nfs://desktop/home/evan/documents/multimedia/
02:03:32 T:140644474386496   ERROR: CGUIMediaWindow::GetDirectory(nfs://desktop/home/evan/documents/multimedia/) failed
02:03:32 T:140644474386496   DEBUG: CGUIMediaWindow::GetDirectory (sources://video/)
02:03:32 T:140644474386496   DEBUG:   ParentPath = []
After a little more fiddling I've managed to get libnfs working in XBMC on the same machine the NFS server is running on. Only when using the git version. So something was fixed there at least. My HTPC still can't connect though.

I'm not sure what the deal was with the debug log in my last post not having an error message, it's showing the same thing as in my OP when using libnfs-git now.

The newer version of libnfs does come with a nifty little nfs-ls utility that makes debugging a little easier. After recompiling and adding (actually removing, I had to remove a set_error call that was just 'rpc_service failed' to get to the real error message) a little debug code in libnfs I'm seeing the error

Failed to mount nfs share : mount/mnt call failed with "rpc_service: socket error Connection refused(111)."

when running nfs-ls nfs://

I'm not seeing anything in my NFS servers journal about refusing a connection. So it looks like it' not even making it's way to my desktop. Hmmm..
I spent some more time debugging this and tracked it down to an issue in the libnfs library.

A commit has already been made into the libnfs master branch that fixes this, however another issue is present in the master, so we can't just use a git compiled version. Instead this commit must be applied to libnfs-1.9.3 to fix the issue.

Marking as solved!