Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS resolution fails on debian 12.8.0 in a VM #623

Open
LexiconCode opened this issue Dec 2, 2024 · 2 comments
Open

DNS resolution fails on debian 12.8.0 in a VM #623

LexiconCode opened this issue Dec 2, 2024 · 2 comments

Comments

@LexiconCode
Copy link

LexiconCode commented Dec 2, 2024

DNS resolution fails/misconfigured when running ansible-playbook main.yml . Specifically, the error message indicates a failure to resolve the hostname registry-1.docker.io due to a connection issue with the DNS server running on localhost (::1 refers to the IPv6 loopback address):

in TASK [Ensure internet-monitoring environment is running.
dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:55381->[::1]:53: read: connection refused

Full Error

root@net:~/internet-pi# ansible-playbook main.yml

... 

TASK [Ensure internet-monitoring directory is not a Git repository.] ********************************************************
ok: [127.0.0.1]

TASK [Copy templated internet-monitoring files into place.] *****************************************************************
ok: [127.0.0.1] => (item={'src': 'docker-compose.yml.j2', 'dest': 'docker-compose.yml'})
ok: [127.0.0.1] => (item={'src': 'grafana-config.monitoring.j2', 'dest': 'grafana/config.monitoring'})
ok: [127.0.0.1] => (item={'src': 'prometheus.yml.j2', 'dest': 'prometheus/prometheus.yml'})
ok: [127.0.0.1] => (item={'src': 'prometheus-pinghosts.yaml.j2', 'dest': 'prometheus/pinghosts.yaml'})

TASK [Ensure internet-monitoring environment is running.] *******************************************************************
fatal: [127.0.0.1]: FAILED! => {"actions": [{"id": "ping", "status": "Pulling", "what": "image"}, {"id": "speedtest", "status": "Pulling", "what": "image"}, {"id": "nodeexp", "status": "Pulling", "what": "image"}, {"id": "prometheus", "status": "Pulling", "what": "image"}, {"id": "grafana", "status": "Pulling", "what": "image"}], "changed": false, "cmd": "/usr/bin/docker compose --ansi never --progress json --project-directory /root/internet-monitoring up --detach --no-color --quiet-pull --no-build --", "containers": [], "images": [], "msg": "Error when processing ping: Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58701->[::1]:53: read: connection refused\nError when processing grafana: context canceled\nError when processing nodeexp: context canceled\nError when processing prometheus: context canceled\nError when processing speedtest: context canceled\nGeneral error: Error response from daemon: Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58701->[::1]:53: read: connection refused", "rc": 18, "stderr": "{\"id\":\"ping\",\"text\":\"Pulling\"}\n{\"id\":\"speedtest\",\"text\":\"Pulling\"}\n{\"id\":\"nodeexp\",\"text\":\"Pulling\"}\n{\"id\":\"prometheus\",\"text\":\"Pulling\"}\n{\"id\":\"grafana\",\"text\":\"Pulling\"}\n{\"id\":\"ping\",\"text\":\"Error\",\"status\":\"Get \\\"https://registry-1.docker.io/v2/\\\": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58701-\\u003e[::1]:53: read: connection refused\"}\n{\"id\":\"grafana\",\"text\":\"Error\",\"status\":\"context canceled\"}\n{\"id\":\"nodeexp\",\"text\":\"Error\",\"status\":\"context canceled\"}\n{\"id\":\"prometheus\",\"text\":\"Error\",\"status\":\"context canceled\"}\n{\"id\":\"speedtest\",\"text\":\"Error\",\"status\":\"context canceled\"}\n{\"error\":true,\"message\":\"Error response from daemon: Get \\\"https://registry-1.docker.io/v2/\\\": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58701-\\u003e[::1]:53: read: connection refused\"}\n", "stderr_lines": ["{\"id\":\"ping\",\"text\":\"Pulling\"}", "{\"id\":\"speedtest\",\"text\":\"Pulling\"}", "{\"id\":\"nodeexp\",\"text\":\"Pulling\"}", "{\"id\":\"prometheus\",\"text\":\"Pulling\"}", "{\"id\":\"grafana\",\"text\":\"Pulling\"}", "{\"id\":\"ping\",\"text\":\"Error\",\"status\":\"Get \\\"https://registry-1.docker.io/v2/\\\": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58701-\\u003e[::1]:53: read: connection refused\"}", "{\"id\":\"grafana\",\"text\":\"Error\",\"status\":\"context canceled\"}", "{\"id\":\"nodeexp\",\"text\":\"Error\",\"status\":\"context canceled\"}", "{\"id\":\"prometheus\",\"text\":\"Error\",\"status\":\"context canceled\"}", "{\"id\":\"speedtest\",\"text\":\"Error\",\"status\":\"context canceled\"}", "{\"error\":true,\"message\":\"Error response from daemon: Get \\\"https://registry-1.docker.io/v2/\\\": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58701-\\u003e[::1]:53: read: connection refused\"}"], "stdout": "", "stdout_lines": []}

PLAY RECAP ******************************************************************************************************************
127.0.0.1                  : ok=10   changed=1    unreachable=0    failed=1    skipped=8    rescued=0    ignored=0
  • modified inventory.ini
[internet_pi]
#10.0.100.52 ansible_user=pi

# Comment out the previous line and uncomment this to run inside Raspberry Pi.
127.0.0.1 ansible_connection=local ansible_user=pi
  • config.yml
    unmodified but for change-this-password

Troubleshooting

  • nslookup registry-1.docker.io
root@net:~/internet-pi# nslookup registry-1.docker.io
;; communications error to ::1#53: connection refused
;; communications error to ::1#53: connection refused
;; communications error to ::1#53: connection refused
;; communications error to 127.0.0.1#53: connection refused
;; no servers could be reached

Temp solution

  1. Update /etc/resolv.conf:
    sudo nano /etc/resolv.conf

  2. Add or update lines to:

nameserver 8.8.8.8
nameserver 8.8.4.4
  1. restart docker
    sudo systemctl restart docker
@sarhatabaot
Copy link

This does seem to fix the issue. Thanks for this, spent ~2 hours trying to figure this out.

@LexiconCode
Copy link
Author

This does seem to fix the issue. Thanks for this, spent ~2 hours trying to figure this out.

Did you have the same issue with IPv6 or IPv4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants