home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.67k stars 30.81k forks source link

DNS issues in homeassistant docker container #17561

Closed davidrhunt closed 5 years ago

davidrhunt commented 6 years ago

Home Assistant release with the issue:

Home Assistant 0.80.1

Last working Home Assistant release (if known): This hasn't worked since I started using hassio, only recently debugged and understood the issue. I tried updating the OS from the previous Resin OS to the news Hass OS. I tried turning off the Pi Hole add-on. I tried disabling DuckDNS and Lets Encrypt. None of these experiments changed the behavior. The only fix was changing the DNS configuration as outlined below.

Operating environment (Hass.io/Docker/Windows/etc.):

Hass.io on Raspberry Pi running Hass OS

Component/platform:

iOS component, IFTTT component, any component trying to reach a host that requires DNS resolution

Description of problem: When trying to resolve DNS entries components get errors such as the traceback below.

The default /etc/resolv.conf on the homeassistant docker container is:

nameserver 172.30.32.2
options ndots:0

With this setup the iOS component and IFTTT are unable to resolve DNS entries and the notifications do not work.

If I update /etc/resolv.conf on the homeassistant docker container to:

nameserver 10.0.1.240

Note: 10.0.1.240 is the IP on the Raspberry Pi running HassIO with the Pi-Hole add-on.

then iOS notifications work as expected (haven't had a chance to test IFTTT yet).

Traceback (if applicable):

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ios-push.home-assistant.io', port=443): Max retries exceeded with url: /push (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6e331730>: Failed to establish a new connection: [Errno -3] Try again',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1177, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/notify/__init__.py", line 117, in async_notify_message
    await notify_service.async_send_message(**kwargs)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/notify/ios.py", line 94, in send_message
    req = requests.post(PUSH_URL, json=data, timeout=10)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 513, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ios-push.home-assistant.io', port=443): Max retries exceeded with url: /push (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6e331730>: Failed to establish a new connection: [Errno -3] Try again',))

Additional information: Additional system information:

Hass OS

{
    "result": "ok",
    "data": {
        "chassis": "embedded",
        "cpe": "cpe:2.3:o:home_assistant:hassos:1.11:*:production:*:*:*:rpi3:*",
        "features": [
            "reboot",
            "shutdown",
            "services",
            "hostname",
            "hassos"
        ],
        "hostname": "hassio",
        "operating_system": "HassOS 1.11",
        "deployment": "production",
        "kernel": "4.14.66-v7"
    }
}

Home Assistant

{
    "result": "ok",
    "data": {
        "version": "0.80.1",
        "last_version": "0.80.2",
        "machine": "raspberrypi3",
        "image": "homeassistant/raspberrypi3-homeassistant",
        "custom": false,
        "boot": true,
        "port": 8123,
        "ssl": true,
        "watchdog": true,
        "wait_boot": 600
    }
}

Supervisor

{
    "result": "ok",
    "data": {
        "version": "138",
        "last_version": "138",
        "channel": "stable",
        "arch": "armhf",
        "wait_boot": 5,
        "timezone": "America/Los_Angeles",
        "addons": [
            {
                "name": "SSH server",
                "slug": "core_ssh",
                "description": "Allows connections over SSH",
                "state": "started",
                "version": "4",
                "installed": "4",
                "repository": "core",
                "icon": false,
                "logo": true
            },
            {
                "name": "Samba share",
                "slug": "core_samba",
                "description": "Expose Hass.io folders with SMB/CIFS",
                "state": "started",
                "version": "6",
                "installed": "6",
                "repository": "core",
                "icon": false,
                "logo": true
            },
            {
                "name": "Pi-hole",
                "slug": "a0d7b954_pi-hole",
                "description": "Network-wide ad blocking using your Hass.io instance",
                "state": "started",
                "version": "2.1.0",
                "installed": "2.1.0",
                "repository": "a0d7b954",
                "icon": true,
                "logo": true
            },
            {
                "name": "Configurator",
                "slug": "core_configurator",
                "description": "Browser-based configuration file editor for Home Assistant.",
                "state": "started",
                "version": "2",
                "installed": "2",
                "repository": "core",
                "icon": false,
                "logo": false
            },
            {
                "name": "Duck DNS",
                "slug": "core_duckdns",
                "description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support",
                "state": "started",
                "version": "1.5",
                "installed": "1.5",
                "repository": "core",
                "icon": false,
                "logo": true
            },
            {
                "name": "Mosquitto broker",
                "slug": "core_mosquitto",
                "description": "An Open Source MQTT broker",
                "state": "started",
                "version": "2.0",
                "installed": "2.0",
                "repository": "core",
                "icon": false,
                "logo": true
            }
        ],
        "addons_repositories": [
            "https://github.com/hassio-addons/repository"
        ]
    }
}

If any further information is needed please let me know. Thanks!

deftdawg commented 5 years ago

My guess is this is a duplicate of https://github.com/home-assistant/hassio/issues/663 ... if it is please try out the workaround at the bottom of the thread and close this issue.

balloobbot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

bearzibubbs commented 5 years ago

Is this still an issue you are experiencing? Can you please try upgrading to the latest version of Home Assistant (0.90) and report back if this is still a problem? Thanks!

bburwell commented 5 years ago

Not close on the the specs, but I had the same issue of not being able to get to any external sites. Could ping by IP but not name - 0.89.x through 0.90.1). My setup is a PI3 running ubuntu mate with home assistant in docker (running 0.90.1). Once i created /etc/docker/daemon.json in Ubuntu and added my local router as the dns and rebooted everything worked. Followed this link: https://l-lin.github.io/post/2018-09-03-docker_ubuntu_18_dns/
Hope this helps someone.

stale[bot] commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.