Issue accessing shares on domain

Ok so after backing up the database then wiping my library I ended up removing all my media sources (movie and tv). I then ended up making sure I had ZERO movies in the main “movies” menu option.

Next step was to go into settings,media,library,videos and clicked “add videos…”. Then I gave it a new name (this time to test I used “mo” as the source name) then clicked “browse”. I used “Add network location…” and filled out all the info. After filling out all my information correctly it added the source like a charm and allowed my to browse my new source of movies called “mo”.

So what did I do different? I used the IP address of my media server rather than the hostname (which I tried the FQDN and just the name).

So this whole time it has been about freaking DNS! So my new question is why would OSMC not be using the correct DNS server when trying to resolve names on my local network? Is there someway in OSMC or in linux that I can do the equivalent of nslookup and see what dns server it’s using for resolutions?


You can login via SSH and then run all kind of DNS tools on linux. nslookup exists but also a tool called dig. Normally the first quick step is to do a ping <HOSTNAME> to see what is resolved. But I think crucial is to not mix DNS Names and Netbios Names. I actually use DNS names instead of IP addresses on my SMB shares on OSMC but I know many people have issues with DNS and IP address is recommended in that for stability. I use fstab based mounts and not Kodi source base so that might also be a difference in name resolution stability.

As soon as I made that post I slapped my forehead… I was blanking on the fact I could just SSH to get console access and have me a bash prompt.

The first thing I did was type ping then got my replies… then I tried ping, resolved and got my replies… then I tried ping mediaserver, resolved like clockwork and I got replies…

Then I remembered I could go into My OSMC and look at the network settings… Sure enough, primary DNS server is my DNS server… So not a DNS issue then…?

So now I’m confused… I can add media IF I use an IP address to define the server. It will not work with my hostname (that I can ping just fine). What in the world am I doing wrong?

Well it could be a Kodi SMB Client lookup issue.

  1. Did you try a FQDN instead of just mediaserver?
  2. I wonder if you would consider fstab based mounts instead of Kodi smb client approach?

OK so tried to ping mediaserver.HOUSE.local and that gave me a “bad address”. Also, I’m willing to try anything as long as I can continue to use my old kodi boxes like I currently do with Windows domain shares (using my AD 2012R2 server with my 2008R2 file server).

But do you think the issue is that it is trying to use the FQDN when I use just mediaserver as the source server for some reason?

No I was assuming that Kodi might have an issue when just resolving mediaserver instead of FQDN. But now I am more confused. How would ping not be able to do FQDN resolution? Are you sure you correctly used your local domain?

Did you try just mediaserver.local?

You could add an entry to /etc/hosts so the name will always resolve.

Not sure how to answer that. What do you mean “correctly used”?

@bmillham I just tried that for the hell of it since you asked. But I knew that would not work.

My domain name is HOUSE.local. My fileserver name is mediaserver. Therefor the FQDN would be (and is) mediaserver.HOUSE.local. From my windows machine im on right this second I can ping the FQDN and it works as expected (just like on all my other workstations/kodi boxes).

So correct… I CAN ping mediaserver and cannot ping Any other tests you want me to try?

Thanks for the help btw guys!

Well is house.local your proper local domain and if I talk “domain” I don’t mean Windows Domain

I’m going to try some dig tests…

Currently installing dig…

sudo apt-get update
sudo apt-get install dnsutils

Is your DNS server your router? Or is it a windows box? Are you using DHCP, and if so what is the DHCP server?

OK then, what do you mean? You lost me then. All I know is my Windows domain. The one I run via my DC which runs Active Directory. I don’t know any other way to talk about domains in my network environment. Do tell and I’ll give you any answers I can.

No, I have a router (that is just my firewall/router) and I have a Windows 2012R2 AD server. I also have a Windows 2008R2 file server.

My DHCP server is ran from my AD server (DC). My router is nothing more than the default gateway (outbound traffic).

OK so here are some results…

;; ANSWER SECTION:        1200    IN      A

So dig resolves and ping not? Suggest have respective entry in /etc/hosts as suggested by @bmillham to test if it makes a difference

OK well I guess in my haste before I skipped right over that one suggestion. Sorry about that. I just added it and now can ping the FQDN. Let me see if that helps when trying to add the new source as a host instead of an IP now.

So you added short and long name?

my new host file…

::1 osmc localhost6.localdomain6 localhost6 osmc localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Now I can ping the FQDN and the server name mediaserver.

I just popped back into OSMC and tried to add the source using mediaserver as the server name and BAM! now it’s working like a charm!

So… Now that we can make it work as I expect it to work… How can I go about fixing this issue? What is this weird underlying issue? Is there maybe some options I can add to my DHCP scope that will help out? Like maybe 040 NIS Domain Name or 041 NIS Servers?

OK so I finally have brought this to a close thanks to all the help from you guys here at OSMC. It all boiled down to two things…

  1. How I named my domain name
  2. How avahi (aka zeroconf) is configured by default

The Problem

If mDNS is enabled, avahi’s default config is to fail when the host is not found. The default config also uses a specific TLD. Yep you guessed it, it uses .local. So when you have a host set up on you DNS server and it’s not in the mDNS config then anytime you try to resolve a .local TLD it will fail!

The Solution

To fix this issue you have two choices…
[source: Avahi and dot-local addresses on Ubuntu Gutsy – The Fifth Wheel of andrewg]
Note: I had to use the first option because the second does not work even though there is an option for it in the config file. See note at the end.

1. You can just change the way the requests are handled via the nsswitch.conf config file.

  • Type the following command… sudo nano /etc/nsswitch.conf

  • Then find the line that looks like:
    hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns mdns4
    Replace it with something like this:
    #hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns mdns4
    hosts: files myhostname dns mdns4_minimal [NOTFOUND=return] mdns4
    *Note: You could just move dns ahead of mdns4_minimal in the line. I just like to comment out what I change incase I want to undo things in the future.

  • Then just restart OSMC using thereboot command.

2. You can change the TLD that mDNS uses by default.

  • Type the following command… sudo nano /etc/avahi/avahi-daemon.conf

  • Then find the line that looks like:
    Add the following line right below it, something like this:
    *Note: It can be whatever you want.

  • Then just restart OSMC using thereboot command.

Note about option #2

Unfortunately it is not actually possible to change the domain name from “local” to something else, despite the configuration option, this will not actually work.

I suggest that you check the very latest “nss-mdns” release which has support for sharing .local between the mDNS and the local microsoft DNS server. It will intelligently route the queries:

Once you have this version in place (unfortunately it is not yet packaged for ubuntu, you would have to install it yourself); you can disable the script that automatically stops avahi when a .local domain is detected. This script is located in /usr/lib/avahi.
[source: allow /etc/avahi/hosts for domain other than .local · Issue #179 · lathiat/avahi · GitHub - owner of the avahi repository]


Another little side note: For some reason I had to go through my video database and change all my MEDIASERVER references to mediaserver. They seem to work find on Kodi (windows) but not on OSMC (linux). Just wanted to add that last little note in the hopes it helps someone else.