DNS broken in homeassistant container


#1

I know this isn’t the first post on DNS, sorry I couldn’t find the answer

Since I’ve reinstalled hass.io I’m having troubles connecting to external services, due to naming resolution issues. After reading all the other posts I’ve tried to find the cause of the issue, but I’m not able to see why the hassio_supervisor isn’t resolving the DNS for the homeassistant container.

Any help is MUCH appreciated :slight_smile:

HOST MACHINE

[email protected]:~$ nslookup google.com
Server:		10.0.1.1
Address:	10.0.1.1#53

Non-authoritative answer:
Name:	google.com
Address: 172.217.20.110

HASS IO SUPERVISOR

sudo docker container exec -ti hassio_supervisor /bin/bash

bash-4.4# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0

nslookup: can't resolve '(null)': Name does not resolve

Name:      google.com
Address 1: 172.217.20.110 fra02s28-in-f14.1e100.net
Address 2: 2a00:1450:400e:80b::200e ams17s01-in-x0e.1e100.net
bash-4.4#

bash-4.4# nslookup google.com 172.30.32.2
Server:    172.30.32.2
Address 1: 172.30.32.2 e2a6fd2da52f

Name:      google.com
Address 1: 172.217.20.110 fra02s28-in-f14.1e100.net
Address 2: 2a00:1450:400e:80b::200e ams17s01-in-x0e.1e100.net

HOMEASSISTANT

sudo docker container exec -ti homeassistant /bin/bash

bash-4.4# cat /etc/resolv.conf
nameserver 172.30.32.2
options ndots:0

bash-4.4# nslookup google.com
nslookup: can't resolve '(null)': Name does not resolve

nslookup: can't resolve 'google.com': Try again

#2

I do have exactly the same issue since a couple of days.
Tried to reinstall host system (ubuntu 16.04.5 LTS) and hassio - problem remains.

Is there anybody who could guide us in this matter?


#3

I found that if I run socat manually on the hassio_supervisor DNS actually works.
Not sure why it doesn’t autostart (or how I can make that happen)

sudo docker exec -d hassio_supervisor socat UDP-RECVFROM:53,fork UDP-SENDTO:127.0.0.11:53


#4

Same problem here i think a lot of people are suffering from this issue.


#5

upgraded to 0.81.4 and seems I have this issue, any clue?


#6

Hi are you running HassIO on a raspberry pi or VM? Can you ping server.local machines from within a container after running socat manually?


#7

Same problem. I have hassio i docker(s) on Ubuntu 16. Hassio dns resolve ok, but home-assistant container not. After applying command from IngmarVerheij it is now fixed.

I also tried edit resolv.conf on homeassistant docker and set 8.8.8.8. It also worked but after HA restart it was broken again.


#9

I have the same problem any movement on this issue?


#10

Same issue but only in the appdaemon container. Did anybody found a persistent solution yet? pruning and reinstalling appdaemon does not help :frowning:


#11

Did found a solution which works: https://github.com/home-assistant/hassio/issues/497#issuecomment-401496769

Hope this also helps for others!


#12

I’m having DNS issues on my HASSIO installation, it’s driving me mad, any solution for it?


#13

@RoadkillUK did you try this one: https://github.com/home-assistant/hassio/issues/497#issuecomment-401496769


#14

@taste

I’ll be honest, i know little about linux.

I have ssh to my pi, I can get to the folder etc but there is no docker in there (that I can tell), don’t know if I should make a directory, but I tried and failed anyway :slight_smile:

Thanks all the same


#15

This should do it if you are running plain docker on your Pi.

If you are in your PI via ssh type:
sudo nano /etc/docker/daemon.json

This should open the nano editor with an empty file.
copy this in this file:
{
“dns”: [“192.168.25.25”, “8.8.8.8”, “8.8.4.4”]
}

update 192.168.25.25 with your local DNS server mostly your internet router IP address

press ctrl-X and save the file

Type: sudo service docker restart

Wait some minutes and see if your homeassitant comes back alive

If you run hassio on the PI this is not meant for you


#16

I appreciate the time and effort put into helping.

I tried what you said, but sudo didn’t work so I dropped it. I edited the file and tried to save it, however I got this message …

[ Error writing /etc/docker/daemon.json: No such file or directory ]

I don’t think the directory etc/docker exists.

Thanks, anyway.


#17

It says it doesn’t exist because you dropped sudo. The program does not have permission to see it.

Add sudo back in, when it asks for a password enter the root password you set and then continue as they wrote.


#18

It doesn’t like sudo, thanks :slight_smile:

core-ssh:/# sudo nano /etc/docker/daemon.json
-bash: sudo: command not found
core-ssh:/#

#19

I had the same issue some time last week in regards to the docker image. I deleted the docker and recreated it (I have persistent data setup) and that seemed to have corrected the issue, for me at least.


#20

OK, fixed the bugger (hopefully)

Took a snapshot, backed it up.

Reinstalled the damn thing using a USB stick with network configs on.

Put the snapshot back on, had a bit of trouble with mariadb, but I reinstalled that and so far, so good.

Thanks all :slight_smile: