I’m having problems with dns resolving from within homeassistant.
Tried almost everything I’ve found online, creating docker defaults, reinstalling hass.io etc.

The problem I’m facing is the home assistant container isn’t able to resolve dns requests.
When I change the name server in /etc/resolv.conf to let’s say, google DNS everything is working fine.
However after a reboot or restart DNS isn’t working anymore. This results in not working push messages, no external components can be loaded in node-red etc. I don’t use any dns plugins.

After a reboot my home assistant container:

nslookup: can't resolve '(null)': Name does not resolve
cnslookup: can't resolve 'nu.nl': Try again
bash-4.4# cat /etc/resolv.conf
nameserver 172.30.32.2
options ndots:0

Where 172.30.32.2 is my hass.io supervisor.

bash-4.4# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
bash-4.4# nslookup klm.nl
nslookup: can't resolve '(null)': Name does not resolve
Name:      klm.nl
Address 1: 193.57.244.90

So at first it’s not able to resolve, however after a second or three its resolving.
The bass.io supervisor acts as a DNS relay if I understand correctly.

If anyone can point me into the right direction so I can fix this shit permanently I would be very happy :slight_smile:

For the time being I execute a shell command on home-assistant start like echo name server 8.8.8.8 > /etc/resolv.conf but that’s not the way it’s supposed to work.

i have the same problem.

my hass.io container has the ip: 172.30.32.2
and its nameserver is the127.0.0.11

nslookup are working only an external names

in the home-assistant container i have the resolver 172.30.32.2 (aka hass.io container) and here no name lookup ist working.

i think it would be the easiest solution to set my routersgateway as the resolver von all container, but i dont know how.

Please help.

Greetings

Did anyone ever found a fix for this issue? I have the exact same issue as the thread starter. I use Ubunu 18.04LTS which has Docker version 18.06.1-ce, build e68fc7a.

If the supervisor is functioning as an DNS forwarder I would expect to see a listener on port 53 which I don’t.

Can someone tell how DNS resolution is meant to work on hassio?

Thanks.

Hello,

The problem of resolving only external domains and internal domains but not the internal ones just specifying the domain (ex. ping host1 will not work but ping host1.local.domain will) is due to the use of Alpine Linux as base image for the containers. Alpine does not use GNU libc but musl libc and the second one doesn’t support the search directive of the resolv.con* file.
Here the link to the bug that will not be solved* because it was rejected: https://bugs.alpinelinux.org/issues/3977

My advice is to move away from alpine linux and move to a Debian or a CentOS base image, a little bit more “heavy” but more complete for sure.

I’ll try to build up an hass.io image based on different image but I don’t know if I’ve time.

Hope this help out.

I managed to brute force a fix for this issue by making a cronjob that runs every minute or so and executes this command docker exec -d homeassistant bash -c "echo 'nameserver 192.168.1.1' > /etc/resolv.conf"

This way everything seems to work, except for some components that require DNS on startup and dont have any retries if they fail to init, like Pushbullet integration. I guess it could be solved by changing DNS not in homeassistant but in “hassio_supervisor” container which homeassistant is supposedly looks at for DNS resolution

In no way elegant solution, but works.

EDIT:

Unfortunately I can’t seem to edit resolv.conf inside hassio_supervisor

bash-4.4# echo "nameserver 192.168.1.17" > /etc/resolv.conf
bash: /etc/resolv.conf: Permission denied
          

To you all still having this issue, easiest fix is adding your DNS config to the docker daemon. Then, every container created on that host will have the correct DNS already on start up.

https://l-lin.github.io/post/2018-09-03-docker_ubuntu_18_dns/

Did not work for me. Though I did not recreate the container. I tried to reinstall hassio and managed to fk up the whole system by running the simple apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat software-properties-common command. I don’t know how, but it removed lots of packages and failed to complete the installation with an error and… well, os is down.

Make sure you are running the latest version of Home Assistant before reporting an issue. You should only file an issue if...

integration: cert_expiry stale waiting-for-reply