Hi!!
I am having issue with the systemd-resolved service or at least with its configuration when I am trying to execute code through the console. In short all address resolution fails when I am trying to use it. Although seem to not affect socket.getaddrinfo calls, since those I assume use a system call.
Note that last time I ran code from console, around 3 weeks ago, everything worked fine.
To reproduce the issue, first I read the resolve configuration at: /etc/resolv.conf:
nameserver 127.0.0.53
options edns0 trust-ad
search ec2.internal
I see here that I should connect to 127.0.0.53.
From the manual, https://www.man7.org/linux/man-pages/man8/systemd-resolved.service.8.html, I see I should be using port 53. So business as usual so far, but when I am trying to create the connection, I get connection refused.
In [19]: socket.create_connection(('127.0.0.53', 53))
Traceback (most recent call last):
File "<console in[19]>", line 1, in <module>
1 >>> socket.create_connection(('127.0.0.53', 53))
File "/usr/lib/python3.8/socket.py", line 808, in create_connection
806 | if err is not None:
807 | try:
808 >>> raise err
809 | finally:
810 | # Break explicitly a reference cycle
File "/usr/lib/python3.8/socket.py", line 796, in create_connection
794 | if source_address:
795 | sock.bind(source_address)
796 >>> sock.connect(sa)
797 | # Break explicitly a reference cycle
798 | err = None
ConnectionRefusedError(111, 'Connection refused')
System information:
$ uname -a
Linux blue-liveconsole14 6.8.0-1061-aws #64~22.04.1-Ubuntu SMP Thu Jul 16 14:38:59 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Python information:
3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0] on linux
If I am doing anything wrong, please correct me, although everything worked for me previously, for like half year; and I am having no issues in my Always on Tasks. If this is actually an issue please fix it.
Thank you.