Req NFS mount with autofs
#1
I am using XBMC for years and I just created an account to suggest a feature improvement.
So, first of all, hello everyone !

Here is the issue :
I store my libraries on a Synology NAS and share it with my XBMC clients throught NFS.
However, sometimes I need to reboot my NAS (maintenance, update etc.), and the NFS mount points are indeed dead.
The problem is that NFS is not handling error recovery after a server reboot quiet well, and XBMC just fails to access files.

So, my suggestion is to implement the use of autofs instead of simple nfs.
This will allow to :
- reduce unnecessarily resource consumption when xbmc is unused
- mount NFS mount points only when needed (library scan, accessing files)
- and prevent XBMC from getting stucked after servers reboot as it will try to remount it upon request.

I installed myself autofs on raspmbc. I experienced it for more than a year and it is working perfectly, but I think it would be a good idea to integrate it in XBMC natively so that other users do not experience the same issue.
Thanks for reading
Reply
#2
Would be nice, but autofs is not cross platform.
Reply
#3
using the internal nfs client will survive nfs server reboots fine ... if not i would need a debug log (wiki)
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)
Reply
#4
@wsnipex Isn't there an equivalent in other plateforms?
@Memphiz I dont have any logs to provide as I now use autofs and do not encounter this issue anymore. But this is a well known issue about NFS mounts. Once server has rebooted, clients must remount nfs mount points
Reply
#5
as memphiz pointed out: if you use our internal nfs, it should just work. If you used OS level mounts, its not up to kodi.
Reply
#6
ok, then I'll try to use the internal NFS tonight instead of my OS autofs and I'll give you feedback.
Reply
#7
Hi guys,
I was waiting to receive my new rpi before resetting my xbmc installation.So sorry for the delay.
So I tried the internal NFS, and it does not work.
XBMC can see shared folders, and can add them as sources. But while I want to scan library, it starts....and stop immediately telling me no movie was found. And i have no disk activity on my remote NFS share.
I tried the exact same configuration with OS nfs / autofs, and it works fine.
For informations, my PIs run last rapbmc build (now osmc).
Reply
#8
debug log (wiki) - most likely a incompatible server configuration. Read the nfs wiki link in my signature (kodis internal nfs client needs some speical server setup). Without having the debug log yet i suppose your filesystem permissions or user mapping for nfs are wrong. (i know it works with os mounts - os mounts are different story ...)
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)
Reply
#9
Full credit goes to - https://help.ubuntu.com/community/Automa...utofsHowto

You could use this script to enable you to mount the nfs shares at the OS level. This script will run in the background and check your NFS mounts are connected every 60 seconds. There is nothing particularly elegant about this solution but it works. Worst case is your NFS shares will be offline for a max of 60s.

I actually use this in conjunction with an autoshutdown script on my freenas box. Every 3 minutes my freenas pings all the front end ips. If none respond it waits 3 more minutes, tries again and then shuts down. All the front ends send a WOL packet to the freenas box on post. Freenas takes about 3 minutes to boot up which is too long for the boot nfs timeouts on the front ends hence why I use this script.

#!/bin/bash

# AutoNFS v.1.1
#
# 2010-09-02 Jeroen Hoek <[email protected]>:
# * Update script with helpful contributions from other users.
# * Stop using logger, simply echo and let the system log it in /var/log/upstart.
# 2012-07-23 Martin Seener:
# * Use rpcinfo instead of ping to check the status of the NFS server daemon, rather
# than just the server being up.
# * Add some useful mount options for a stable NFS mount.
# 2012-03-12 tobcro:
# * Allow local and remote mountpoint to be different.
# 2010-01-24 Jeroen Hoek <[email protected]>:
# * Initial script.


# Configuration parameters.

# The hostname or IP-address of the fileserver:
FILESERVER="yournfsserverhere"

# Mount Options (see mount man pages for info).
MOUNTOPTS="-o rw,hard,intr,tcp,actimeo=3"

# Check every X seconds (60 is a good default):
INTERVAL=60

# Delimeter used for separating fileserver/client shares below:
DELIMETER="|"

# The shares that need to be mounted. If the local and remote mount point
# differ, write something like "/media/remoteshare|/media/localshare", where "|" is
# the delimeter configured above. If the mount points are the same, you can also use
# the short-hand "/media/share".
MOUNTS=( "/media/exampleRemote1|/media/exampleLocal1" "/media/exampleMount2" )

# Logging. Set to true for debugging and testing; false when everything works. Logs
# are written to /var/log/upstart/autonfs.log.
LOG=true

# End of configuration


function log {
if $LOG; then
echo $1
fi
}


log "Automatic NFS mount script started."

declare -a MOUNTP
while true; do
# Is the NFS daemon responding?
rpcinfo -t "$FILESERVER" nfs &>/dev/null
if [ $? -eq 0 ]; then
# Fileserver is up.
log "Fileserver is up."
for MOUNT in ${MOUNTS[@]}; do
# Split up the share into the remote and local mount point.
MOUNTP=(`echo ${MOUNT//$DELIMETER/ }`)
# The second part of the mount string is the local mount point.
# If there is no second part, local and remote are mounted on
# the same location.
HERE=${MOUNTP[${#MOUNTP[@]}-1]}
THERE=${MOUNTP[0]}
if grep -qsE "^([^ ])+ ${HERE}" /proc/mounts; then
log "$HERE is already mounted."
else
# NFS mount not mounted, attempt mount
log "NFS share not mounted; attempting to mount ${HERE}:"
mount -t nfs ${MOUNTOPTS} ${FILESERVER}:${THERE} ${HERE}
fi
done
else
# Fileserver is down.
log "Fileserver is down."
for MOUNT in ${MOUNTS[@]}; do
# Split up the share into the remote and local mount point.
MOUNTP=(`echo ${MOUNT//$DELIMETER/ }`)
# The second part of the mount string is the local mount point.
# If there is no second part, local and remote are mounted on
# the same location.
HERE=${MOUNTP[${#MOUNTP[@]}-1]}
THERE=${MOUNTP[0]}
if grep -qsE "^([^ ])+ ${HERE}" /proc/mounts; then
# NFS mount is still mounted; attempt umount
log "Cannot reach ${FILESERVER}, unmounting NFS share ${HERE}."
umount -f ${HERE}
fi
done
fi
sleep $INTERVAL
done
Reply
#10
@harlequin80 : thx for your help but the idea was to use the xbmc internal mecanism to handle nfs, without extra package/script. before, I use to mount storage with autofs and it was working perfectly.

@Memphiz : I have some progress (I can only spend about 1 hour per day for this...not that much to debug^^). It seems the problem is not nfs related. I can navigate into files and start a movie/music. The issue is somewhere else. I decided to migrate my database to mysql as I now have 2 rpi running xbmc. The configuration for mysql parameters uses fqdn instead of ip address and it seems not to be resolved on time during boot. This implies that xbmc was very laggy at runtime (do not know why, there is absolutely no log, even in max debug level), and prevented me from navigate in nfs directories. If fixed it by giving ip address and it works now.

But now the problem is : why can't I scan my library and fill properly the mysql database ?? it stills start...and stop immediatly. Logs are useless as there is nothing inside about an error or even a warning. Just two notice lines saying is starts, and then stops.
I followed the kodi wiki page to setup mysql (from scratch, no import). Databases are well created by my user, but never filled.
Reply
#11
Move your userdata way and only put the advancedsettings.xml for your mysqlsetup in it ... then remove the mysql dbs and startup kodi - now try to scrape your stuff. If this works then its something memoried in your old userdata folder. (possible bug)
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)
Reply
#12
Hum I can try to do this.
Looking back, I think I had filled media sources before editing the advancedsttings.xml file with mysql configurqtion, so maybe the problem is there ..
I'll try this evening, and will give you feedback.
Reply
#13
I, finally I restored my userdata and filles sources after connecting to mysql database.
It seems to work well. I'll tell you if I have some issues with nfs connections later.
Thanks
Reply

Logout Mark Read Team Forum Stats Members Help
NFS mount with autofs0