Resolving hostname takes forever

im new to osmc and when i go to my sources, it takes for ever to read nfs://mediaserver/movies-1 for example. it eventually loads after like 30min. why is it taking so long on osmc?

Are you sure that it is a name resolution issue?
What happens when you do ping mediaserver?
Also what is the content of /etc/resolv.conf

Generated by Connection Manager

search lan
nameserver 192.168.1.1

osmc@osmc:~$ ping mediaserver
PING mediaserver (192.168.1.100): 56 data bytes
64 bytes from 192.168.1.100: seq=0 ttl=128 time=6.944 ms
64 bytes from 192.168.1.100: seq=1 ttl=128 time=8.552 ms
^C
— mediaserver ping statistics —
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 6.944/7.748/8.552 ms
osmc@osmc:~$ sudo nano /etc/resolv.conf
osmc@osmc:~$ ping mediaserver
PING mediaserver (192.168.1.100): 56 data bytes
64 bytes from 192.168.1.100: seq=0 ttl=128 time=3.085 ms
64 bytes from 192.168.1.100: seq=1 ttl=128 time=2.435 ms
64 bytes from 192.168.1.100: seq=2 ttl=128 time=4.077 ms
64 bytes from 192.168.1.100: seq=3 ttl=128 time=2.477 ms
64 bytes from 192.168.1.100: seq=4 ttl=128 time=2.311 ms
64 bytes from 192.168.1.100: seq=5 ttl=128 time=2.115 ms
^C
— mediaserver ping statistics —
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 2.115/2.750/4.077 ms

all while the opening multi-path source is open on nfs://mediaserver/Movies-2/

So the name resolution for the ping didn’t had a delay?
If that is the case than I doubt it is a name resolution issue.
Maybe debug enabled logs will tell more.

If you can, assign a static ip to your mediacenter and use that to access the files, it’s known to work better than the host name.

To give you an example, the shared folder I added in windows would always show as disconnected when I logged in, had to access it for windows to show it as online.

When i changed the share from \\osmc\share to \\192.168.178.1\share it always shows as online.

well i thought about that but i seem to have the same freezing effect after installing the fresh os and simply going to add a new share under nfs. so after i click add, then browse, i click nfs and it should show a list of nfs servers but that window just hangs just like mentioned before. here is part of the log

17:42:47.035 T:1264579568   DEBUG: Thread JobWorker start, auto delete: true
17:43:03.816 T:1750070256   DEBUG: script.module.osmcsetting.updates :  - blurp 293 - DialogMediaSource.xml
17:43:17.035 T:1264579568   DEBUG: Thread JobWorker 1264579568 terminating (autodelete)
17:43:53.841 T:1750070256   DEBUG: script.module.osmcsetting.updates :  - blurp 293 - DialogMediaSource.xml
17:44:54.394 T:1959051264   DEBUG: Previous line repeats 1 times.
17:44:54.394 T:1959051264   ERROR: GetDirectory - Error getting nfs://MediaServer/TV_Shows-2/
17:45:33.906 T:1750070256   DEBUG: script.module.osmcsetting.updates :  - blurp 293 - DialogMediaSource.xml
17:46:00.787 T:1239413744   DEBUG: CWebServer[8080]: request received for /jsonrpc
17:46:23.937 T:1750070256   DEBUG: Previous line repeats 31 times.
17:46:23.937 T:1750070256   DEBUG: script.module.osmcsetting.updates :  - blurp 293 - DialogMediaSource.xml
17:46:24.705 T:1239413744   DEBUG: CWebServer[8080]: request received for /jsonrpc
17:47:01.754 T:1938813936   DEBUG: Previous line repeats 11 times.
17:47:01.754 T:1938813936   DEBUG: NFS: Context for MediaServer not open - get a new context.
17:47:03.427 T:1568142320  NOTICE: ES: Client  from ::ffff:192.168.1.112 timed out
17:47:13.967 T:1750070256   DEBUG: script.module.osmcsetting.updates :  - blurp 293 - DialogMediaSource.xml
17:49:09.114 T:1938813936   DEBUG: Previous line repeats 2 times.
17:49:09.114 T:1938813936   ERROR: NFS: Failed to mount nfs share:  (nfs_service failed)
17:49:09.114 T:1959051264   ERROR: Error Getting Directory (nfs://MediaServer/TV_Shows-2/)
17:49:09.115 T:1959051264   DEBUG: DialogProgress::Open called
17:49:09.115 T:1959051264   DEBUG: ------ Window Init (DialogConfirm.xml) ------
17:49:09.115 T:1959051264    INFO: Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
17:49:09.115 T:1517810672   DEBUG: Thread JobWorker start, auto delete: true
17:49:09.132 T:1959044080   DEBUG: CAnnouncementManager - Announcement: OnScreensaverActivated from xbmc
17:49:09.133 T:1959044080   DEBUG: GOT ANNOUNCEMENT, type: 4, from xbmc, message OnScreensaverActivated
17:49:09.145 T:1959051264   DEBUG: ------ Window Init () ------
17:49:09.681 T:1959051264   DEBUG: Getting Directory (nfs://MediaServer/TV_Shows-3/)
17:49:40.822 T:1517810672   DEBUG: Thread JobWorker 1517810672 terminating (autodelete)
17:49:44.061 T:1750070256   DEBUG: script.module.osmcsetting.updates :  - blurp 293 - DialogConfirm.xml

Can we go back a few steps?

1 It’s not clear to me how MediaServer (or is it mediaserver?) is being resolved to the IP address 192.168.1.100. It doesn’t look like avahi, so I’m guessing it’s either been done in /etc/hosts on the Pi or on the router. What is the output from:

nslookup MediaServer

and nslookup mediaserver ?

2 What’s the result of:

showmount -e 192.168.1.100

3 Does showmount -e mediaserver
give the same answer as showmount -e MediaServer ?

4 What’s the output from running the command mount ?

i believe its seen as MediaServer in the router reserved address.

nslookup isnt installed it looks like.

osmc@osmc:~$ nslookup MediaServer
-bash: nslookup: command not found
osmc@osmc:~$ sudo nslookup MediaServer
sudo: nslookup: command not found
osmc@osmc:~$ showmount -e 192.168.1.100
Export list for 192.168.1.100:
/Movies-2      (everyone)
/Movies-3      (everyone)
/TV_Shows-2    (everyone)
/TV_Shows-3    (everyone)
/Videos-2      (everyone)
/Movies-1      (everyone)
/TV_Shows-1    (everyone)
/Documentaries (everyone)
osmc@osmc:~$ showmount -e mediaserver
Export list for mediaserver:
/Movies-2      (everyone)
/Movies-3      (everyone)
/TV_Shows-2    (everyone)
/TV_Shows-3    (everyone)
/Videos-2      (everyone)
/Movies-1      (everyone)
/TV_Shows-1    (everyone)
/Documentaries (everyone)
osmc@osmc:~$ showmount -e MediaServer
Export list for MediaServer:
/Movies-2      (everyone)
/Movies-3      (everyone)
/TV_Shows-2    (everyone)
/TV_Shows-3    (everyone)
/Videos-2      (everyone)
/Movies-1      (everyone)
/TV_Shows-1    (everyone)
/Documentaries (everyone)
osmc@osmc:~$ mount
devtmpfs on /dev type devtmpfs (rw,relatime,size=370520k,nr_inodes=92630,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /run type tmpfs (rw,relatime)
/dev/mmcblk0p2 on / type ext4 (rw,relatime,stripe=1024,data=ordered)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
systemd-1 on /boot type autofs (rw,relatime,fd=33,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
configfs on /sys/kernel/config type configfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdd2 on /media/Media HDD-1 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks)
/dev/sdc1 on /media/Media HDD-4 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks)
/dev/sda1 on /media/Expansion Drive type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks)
/dev/sdb1 on /media/Media_HDD-5 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
/dev/mmcblk0p1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=75104k,mode=700,uid=1000,gid=1000)
osmc@osmc:~$

so everything looks fine and the already scanned movies load fine yet when i go to sources, add, i click nfs, it just freezes. so going to edit sources and clicking ok opens the multi path and only hangs in the nfs shares.

Thanks for that. It looks to be ok.

If you prefer not to supply logs, that’s fine, but I guess you probably realise that we’re not going to be able to take this any further without logs.

sure i will reboot it and will use another sdcard maybe its just a bug but its really annoying.

here it is i left it up all night with logging.

https://pastebin.com/8C5fBtX3

Thanks for the log. It’s only the Kodi log, so, though useful, grab-logs -A would be even more useful. (Am I sounding like a stuck record? ;))

The Kodi log is showing a very large number of NFS errors, so let’s see if we can mount an NFS share manually. Please run the following:

sudo mkdir /mnt/TV_Shows-2
sudo mount -t nfs 192.168.1.100:/TV_Shows-2 /mnt/TV_Shows-2
ls -la /mnt/TV_Shows-2 | head

If the above fails, can you show us the /etc/exports file and list some of the files/directory permissions on the TV_Shows-2 directory on the NFS server?

And out of interest, what’s your NFS server running on?