Media source - Old NAS replaced by new NAS, different hostname

  • Hey everybody,
    this might be a very specific question, but I hope for some input to troubleshoot my little problem here :)

    I'm running two LibreELEC devices:

    - Player 1: Raspberry Pi 4 with LE 11.0.3

    - Player 2: Raspberry Pi 2 with LE 9.2.8

    Both devices get their media from shares configured to hostname OldNAS, which worked fine. But then I replaced OldNAS by a new device with hostname NewNAS.

    Both players have my pi-hole DNS server configured as DNS. /etc/resolv.conf looks the same on both devices.

    So I thought I just create a CNAME entry in pi-hole which points requests for OldNAS to NewNAS.
    On my Player 1 this worked like a charm and all the media from shares and the library, that still points to OldNAS, plays fine now from NewNAS, even after reboots.
    On my Player 2 this does not work and I can't find out the reason.

    Share names, user names etc. are configured identically on NewNAS.
    When I add a new share to NewNAS on Player 2, this works, too. But it won't play the OldNas media, as Player 1 does without any change on the device.

    Any ideas?


    Thanks!
    Thomas

  • Go to Best Answer
  • CNAME should work without a problem. I use DNS to name "services" and then CNAME them to the host, so Kodi uses "kodi--fs1" which points to my server.

    My guess is machine #2 is not using DNS, but probably using mDNS (Avahi). So what I do is (on the server) create mDNS entries as well via a systemd unit avahi-alias. So you might want to make sure your machine #2 is using a FQDN or your DHCP server is pushing the DNS search order. Which will be a problem since the hostname is embedded in the database.

    LE also prefers mDNS over DNS, so you may have to create a systemd unit on your server hosting your file server to create avahi entries. I have a systemd unit called avahi-alias:

    Code
    # cat /etc/systemd/system/[email protected]
    [Unit]
    Description=Publish %i as alias for %H.local via mdns
    [Service]
    Type=simple
    ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %i $(avahi-resolve -4 -n %H.local | cut -f 2)"
    [Install]
    WantedBy=multi-user.target


    It is enabled as

    sudo systemctl enable --now [email protected]

    kodi-fs1 being the mDNS alias, ".local" is the mDNS domain namespace. The simplest solution is already from chewitt, which is change the hostname of your file server. This solution would also require your old file server to be offline, or Avahi not publishing there.

    The other simple solution is creating a hosts entry on the LE device in /storage/.config/hosts.conf. You would have to dig into what's causing the problem here to figure out the appropriate solution, it's probably as simple as using avahi-resolve, nslookup, ping, on the LE device to figure out what's being resolved and what is resolving it.

  • Thanks for the detailed information. I like the way of using DNS to have a single point of truth to "redirect" to the respective devices.

    I thought about keeping the hostname for my new device, but it was related to the harware vendor and it wouldn't make sense with the new device.

    Anyway, I think the host entry did it finally. LE now "finds" its media on the new NAS.