Freebsd and nfs:// protocol

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #1
Hi Guys,
Using FreeBSD, I can't get Kodi to recognise nfs:// sources.

NFS client is setup and configured, shares are mounted and working
at the OS level.

NFS does not show as an option when adding sources.

If I manually add nfs://192.168.1.2/media/films/ the following log entry occurs.
(full log at http://pastebin.com/5SD6i7fM)

13:48:18 T:34682729472 DEBUG: CGUIMediaWindow::GetDirectory (nfs://192.168.1.2/media/films/)
13:48:18 T:34682729472 DEBUG: ParentPath = [sources://video/]
13:48:18 T:34682729472 WARNING: Create - unsupported protocol(nfs) in nfs://192.168.1.2/media/films/
13:48:18 T:34682729472 ERROR: CGUIMediaWindow::GetDirectory(nfs://192.168.1.2/media/films/) failed
13:48:18 T:34682729472 DEBUG: CGUIMediaWindow::GetDirectory (sources://video/)

Full log at pastebin.com

Title: kodilog-201504051400
URI: http://pastebin.com/5SD6i7fM

This is a clean build/install of Kodi from FreeBSD ports (ie built from source)
Build options - all enabled (default is all except nonfree (rar ccx ffmpeg)

uname -a
FreeBSD testbox.asgard.uk 9.3-RELEASE-p10 FreeBSD 9.3-RELEASE-p10 #0:
Tue Feb 24 21:28:03 UTC 2015
[email protected]:/usr/obj/usr/src/sys/GENERIC
amd64

I have two RaspBMC devices running fine using nfs:// sources and both
use MySQL on the server. I'd like the FreeBSD based install to also
share the MySQL db but obviously I need the same source paths.

I'm not really a Linux user, but I had the same problem with Ubuntu and kodi. I didn't look any further into that since I'd already discovered the problem with FreeBSD, my preferred OS.

In case it's relevant, the server is also running FreeBSD with 4x2TB HDD in RAIDz ZFS mode and the shares work in FreeBSD, Linux, Windows and Android clients.
find quote
ironic_monkey Online
Posting Freak
Posts: 1,491
Joined: Nov 2013
Reputation: 71
Post: #2
if you mount on system level you just add the mount dir as a source.
Alternatively you can use the builtin nfs support but your build is compiled without the support (you need libnfs).
find quote
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #3
Ah...that's a problem then since if I use a different source path it doesn't work with the shared MySQL database on the server. Attempts to play a video or song return with file not found - do you want to remove this item from the database..

I wonder why the default build doesn't include libnfs? Maybe it's a linuxism.

Thanks for the suggestion. Worst case is that I dump the database and redo all clients to use mounted filesystem shares.
find quote
ironic_monkey Online
Posting Freak
Posts: 1,491
Joined: Nov 2013
Reputation: 71
Post: #4
you could use path substitution. it isnt really a linuxism as such just that the support is optional and i guess whoever built your build skipped it. i think libnfs should be easy peasy to port - it builds fine on darwin.
(This post was last modified: 2015-04-05 16:34 by ironic_monkey.)
find quote
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #5
Thanks, I'll email the maintainer of the port and see what he thinks.
I might have another go with Linux too. I'd like a faster box to do library "stuff" with since the RasPi is a bit underpowered. or get a new Raspi 2 :-)
find quote
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #6
I found that libnfs is already in the ports tree and the Makefile has --disable-nfs in the CONFIGURE_ARGS+= section.

It's building now with --disable-nfs removed and libnfs installed...

...and...some progress, but no cigar.

I can manually add a nfs:// path but can't connect. If I add just nfs://192.168.1.2 kodi can see the shares which are exported but still can't drill down. "RPC Packet not accepted by the server" errors and that appears to be a solved/done deal as far as Kodi, linux and libnfs is concerned. Libnfs is at v1.3 on FreeBSD which appears to be ancient. There may be a good reason it was never updated.

Oh well, I'll email both kodi and libnfs port maintainers and see if they are interested in solving this. My programming skills were deprecated years ago ;-)
find quote
Memphiz Offline
Kodi MVP
Posts: 16,171
Joined: Feb 2011
Reputation: 229
Location: germany
Post: #7
your problem is that the server is not configured correctly for usage with kodi. Read the nfs link in my signature (especially the stuff about connections from privileged ports)

AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
find quote
Milhouse Offline
Team-Kodi Member
Posts: 13,170
Joined: Jan 2011
Reputation: 664
Post: #8
(2015-04-06 16:12)dave2015 Wrote:  I can manually add a nfs:// path but can't connect. If I add just nfs://192.168.1.2 kodi can see the shares which are exported but still can't drill down. "RPC Packet not accepted by the server" errors and that appears to be a solved/done deal as far as Kodi, linux and libnfs is concerned. Libnfs is at v1.3 on FreeBSD which appears to be ancient. There may be a good reason it was never updated.

I've found that you can't drill down into folders exported by a FreeNAS (FreeBSD) server, but this feature works perfectly on folders exported by a ReadyNAS (Debian-based) server, so it's potentially a server (FreeBSD?) issue. This is when testing with the latest Kodi 15/libnfs master for RPi.

The easiest solution is to manually add the folders to your sources.xml file, by opening the file in a text editor.

Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
find quote
Memphiz Offline
Kodi MVP
Posts: 16,171
Joined: Feb 2011
Reputation: 229
Location: germany
Post: #9
Check filesystem permissions on the server then and ensure that the UID mapping in /etc/exports is correct on the server side.

AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
find quote
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #10
(2015-04-07 01:59)Memphiz Wrote:  your problem is that the server is not configured correctly for usage with kodi. Read the nfs link in my signature (especially the stuff about connections from privileged ports)

Something very weird happened. (BTW, I'd already found your nfs wiki entry, thanks for writing it)
Anyway, I added -insecure into the /media exports line and separated out a small of section of etc/rc,conf with the new lines so I could keep track of edits.

Code:
#New for Kodi                          
mountd_flags="-n"                      
nfs_reserved_port_only="NO"            
nfs_server_flags="-u -t -n 4"          
weak_mountd_authentication="YES"

and it still didn't work on the "normal" shares, but I had made a new one, fred, nfs://192.168.1.2 into the root dir. Suddenly that started working, but only into /usr/home and /stuff, not to /media. On checking /etc/exports I found the working shares were -maproot=0 and /media, for some reason, I'd set to maproot=root.

I changed the /media export to -maproot=0. That works, via the "fred" share to root dir, but none of the others, eg nfs://192.168.1.2/tv worked.

I did another service mountd restart and service nfsd restart again (also did both after each change above as well as restarting kodi) and suddenly all the shares were working!

Out of curiosity, I commented out the lines from /etc/rc.conf listed above as #New for Kodi and again restarted the relevant services and the shares all failed. the relevant "culprit" was the mountd_flags="-n" which when added back in restored the shares.

This one certainly had me scratching my head and I was sure I'd read your wiki entry carefully. I had mountd_flags="-r" and may have mis-read that as "-n"

I've now copied over .kodi/userdata/advancedsettings.xml from a RasPi to the PC and it's happily sharing the database.

Anyway, thanks for the extra poke and making me re-read your NFS wiki entry again. Big Grin

In summary:

For nfs:// protocol shares on FreeBSD,

Install net/libnfs from ports or packages

Find and remove --disable-nfs from the /usr/posrts/multimedia/kodi/Makefile
(Line is CONFIGURE_ARGS+= --disable-debug --disable-nfs --disable-alsa --disable-pulse)

Build Kodi from ports, either portinstall -c kodi or make install clean in the ports dir.

On the NFS server
/etc/exports
Code:
/media  -maproot=0 -alldirs -network=192.168.1.0/24
/stuff  -maproot=0 -alldirs pc1 pc2 laptop laptop2 testbox 192.168.1.107 192.168.1.50
/usr/home -maproot=0 -alldirs pc1 pc2 laptop laptop2 testbox 192.168.1.107 192.168.1.50

On the PC
NFS related bits of /etc/rc.conf
Code:
nfs_server_enable="YES"
rpcbind_enable="YES"
mountd_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
mountd_flags="-n"

Finish off with
Code:
service mountd restart
service nfsd restart
find quote
Milhouse Offline
Team-Kodi Member
Posts: 13,170
Joined: Jan 2011
Reputation: 664
Post: #11
(2015-04-07 10:40)Memphiz Wrote:  Check filesystem permissions on the server then and ensure that the UID mapping in /etc/exports is correct on the server side.

Actually, now that I've checked this again - my previous post is inaccurate (my memory is failing...). The problem with FreeNAS is that it doesn't appear in the Browse -> Network Filesystem (NFS) listing, whereas ReadyNAS does, so it's some sort of announcement problem with FreeNAS. Adding a network location with the FreeNAS server details works perfectly.

It might be interesting to know if the OP is able to see their FreeBSD server in the Browse listing now that they've fixed the initial problem, or this might just be a FreeNAS issue.

Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
find quote
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #12
(2015-04-07 16:43)Milhouse Wrote:  It might be interesting to know if the OP is able to see their FreeBSD server in the Browse listing now that they've fixed the initial problem, or this might just be a FreeNAS issue.

No, there's still an announcement issue.

I used "Add network location..." to add in nfs://192.168.1.2 which then allowed me to browse and add the announced shares available from the server. For completeness and accuracy of making sure the share paths were exactly the same as my two Rasberry Pi installs, I copied the sources.xml file over to the new FreeBSD box and they worked. Also the advancedsettings.xml to get the server MySQL connection.
find quote
Memphiz Offline
Kodi MVP
Posts: 16,171
Joined: Feb 2011
Reputation: 229
Location: germany
Post: #13
Yeah the problem is - nfs does not do announcing. Its a polling approach (iirc some udp broadcast) - some nfs servers don't see the broadcast (might be related to network switch/router settings) or are not answering it ...

AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
find quote
dave2015 Offline
Junior Member
Posts: 10
Joined: Apr 2015
Reputation: 0
Post: #14
Final update; The FreeBSD port maintainer for Kodi was unaware of libnfs now being available in the FreeBSD ports tree. He's just updated the Kodi port from 14.0 to 14.2 and added the dependency for net/libnfs as well as a build-time config option to switch it off or on.

I've tested it and it works with the previously mentioned caveats.
(This post was last modified: 2015-04-12 23:28 by dave2015.)
find quote