Outdated - Using app-daemon - a cautionary tale

Update:

The title has been updated as the root cause of the problem was not AppDaemon. It seems I got caught out by the latest auto-update of the hassio_supervisor. It was this update that introduced core-dns. I reverted to an earlier state (luckily the docker server is actually a Smartos KVM and I simply rolled back the ZFS datasets) and followed the instructions in #43

I’ll leave this here for archival purposes only.

This may well be a “well-known-gotcha”, but it wasn’t known to me.
TL:DR
When you install the appdaemon container, a dns container is also installed. Unfortunately, the latter doesn’t show up in the hassio dashboard.

If you use full internet domain names in your local network (e.g. mqtt.mydomain.net) rather than (e.g.) mqtt.local, DNS name resolution in the homeassistant container will fail because the homeassistant container will start to use the newly installed dns server; and this dns server defaults to using google’s upstream dns servers rather than your local dns server. Thus, dns lookups for mqtt.mydomain.net will fail. You need to expose the dns container in the hassio dashboard and change its configuration to point to your own dns server.

Background

I have a new hassio installation inside an existing docker server. My local network uses full internet domain names of the form host.mydomain.net and these are resolved using an internal dns server on the address 172.29.1. All devices on the internal network use this internal dns server.

The Problem

HA worked fine, able to resolve mqtt.mydomain.net, unifi.mydomain.net etc, until I installed appdaemon so I could use schedy. At this point, the mqtt devices and sensors stopped working, as did the unify sensors.

When I ssh’d into the docker server, I could see that there was an additional amd64-hassio-dns docker container that wasn’t there before. (I presume this was installed alongside appdaemon to provide DNS for the docker environment, though I could find no mention of it in the appdaemon documentation).

When I looked at the config for this container (in /usr/share/hassio/dns/corefile) it showed

.:53 {
    log
    hosts /config/hosts {
        fallthrough
    }
    forward . dns://1.1.1.1 dns://8.8.8.8 {
        health_check 10s
    }
}

i.e., the docker dns server was bypassing my local dns server and going straight to google to resolve un-resolved names. Of course, google knows nothing of mydomain.net.

Now, I could have modified the json directly, but I was concerned that this might get overwritten by an upgrade, so I went back to HA and installed the dns-masq hassio addon. This exposed the dns server’s config in the hassio dashboard and I modified it to be

.:53 {
    log
    hosts /config/hosts {
        fallthrough
    }
    forward . dns://172.29.12.1 dns://1.1.1.1 dns://8.8.8.8 {
        health_check 10s
    }
}

where 172.29.12.1 is my internal dns server.
After rebooting the whole docker server, my mqtt devices re-appeared.

I hope this helps somebody else.

you didn’t happen to just install Appdaemon in the last day or so did you?

If you did then I think that’s just a horrible coincidence and AD isn’t the problem.

The Hassio supervisor just did an auto-update in that same time frame and that is what installed the hassio-dns container not AD.

There have been a few threads about it in the forums. Do a search and there are some pretty hacky workarounds until it gets officially fixed.

Thanks for the heads-up.

It’s true: I added appdaemon on Friday.

Since I wrote this, I’ve begun to doubt my own analysis anyway, because it seems core-dns was installed automatically, not dns-masq, and the config I had working yesterday has broken since then. Very odd.

I’ll do more digging.

Yeah, I’m pretty sure that’s when the hassio-supervisor update came out and added that dns container.

Good luck…

Correct. I hate and always challenge coincidence, but it seems that this is really a coincidence.
I’ve updated the root post, but I’ll leave the thread here for archival purposes.

That is not true. You are mixing up world here.
It just crossed your tinkering with an Hassio Supervisor update (179).
Hass.io Supervisor 180 has been released to address these issues.

TL;DR, this is no way related to AppDaemon or the add-on.

For more information, you could look at this topic:

@frenck I think our posts crossed in the ether. I’ve just acknowledged the root cause and updated the root post.

1 Like