Temporary failure in name resolution on Ubuntu server 22.04.3 LTS

Jon LaBadie ubu at labadie.us
Tue Nov 28 01:44:15 UTC 2023


On Tue, Nov 28, 2023 at 12:35:26AM +0100, Bo Berglund wrote:
>On Mon, 27 Nov 2023 12:27:09 -0500, Jon LaBadie <ubu at labadie.us> wrote:
>
>>On Mon, Nov 27, 2023 at 03:25:40PM +0100, Bo Berglund wrote:
>>>On Sun, 26 Nov 2023 21:33 +0100, Tom H wrote:
>>>
>>>> I read the ubuntu-users@ archives more or less weekly, and I've just
>>>> seen your "resolv.conf" thread and your last post:
>>>>
>>>> https://lists.ubuntu.com/archives/ubuntu-users/2023-November/311569.html
>>>>
>>>> Your immediate problem can be solved by changing the "resolved"
>>>> configuration since it's controlling "resolv.conf".
>>>>
>>>> Create "/etc/systemd/resolved.conf.d/bo.conf" [ feel free to name it
>>>> something else :) ].
>>>>
>>>> $ /etc/systemd/resolved.conf.d/bo.conf
>>>> [Resolve]
>>>> DNS=the_nameservers_that_you_want_(space_separated)
>>>>
>>>> This should ensure that you get your nameservers in "resolv.conf".
>>>
>>>About the file to create:
>>>Do you mean I should create *directory*
>>>  /etc/systemd/resolved.conf.d
>>>and then place text file bo.conf inside that dir?
>>>
>>>> To investigate your network setup more generally, find out what
>>>> networking packages are installed with:
>>>>
>>>> dpkg-query -W -f='${binary:Package}\n' | grep -E
>>>> 'ifupdown|netplan|network-manager|resolv'
>>>>
>>>> On my laptop, this command lists:
>>>>
>>>> libnetplan0:amd64
>>....
>>>> systemd-resolved
>>>
>>>When I try on the remote system I get this:
>>>$ dpkg-query -W -f='${binary:Package}\n' | grep
>>>-E'ifupdown|netplan|network-manager|resolv'
>>
>>
>>You left out a space after -E
>
>I just copied the command in the email...
>But here it is (newsreader split the line) after space added:
>
>$ dpkg-query -W -f='${binary:Package}\n' | grep -E
>'ifupdown|netplan|network-manager|resolv'
>ifupdown
>libnetplan0:amd64
>netplan.io
>resolvconf
>
>>
>>>grep: updown|netplan|network-manager|resolv: No such file or directory
>>>
>>>So somehow my system does not really behave...
>>>
>>
>>Assuming "systemd-resolved" is installed, check whether it is in use.
>>
>>$ systemctl status systemd-resolved
>
>This is the result:
>
>$ systemctl status systemd-resolved
>? systemd-resolved.service - Network Name Resolution
>     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled;
>vendor preset: enabled)
>     Active: active (running) since Sun 2023-11-26 07:05:58 CST; 1 day 9h ago
>       Docs: man:systemd-resolved.service(8)
>             man:org.freedesktop.resolve1(5)
>
>https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
>
>https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
>   Main PID: 5669 (systemd-resolve)
>     Status: "Processing requests..."
>      Tasks: 1 (limit: 1013)
>     Memory: 4.1M
>        CPU: 886ms
>     CGroup: /system.slice/systemd-resolved.service
>             +-5669 /lib/systemd/systemd-resolved
>
>>
>>>I have it installed, but am not using it for my name resolution.
>>>So I get:
>>>
>>>$ systemctl status systemd-resolved
>>>? systemd-resolved.service - Network Name Resolution
>>>      Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
>>>      Active: inactive (dead)
>>>        Docs: man:systemd-resolved.service(8)
>>>              man:org.freedesktop.resolve1(5)
>>>              https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
>>>              https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
>>>
>>>
>>If you are using systemd-resolved for your DNS the reason
>>/etc/resolv.conf says "do NOT edit" is because that package
>>uses files in /etc/systemd.  Specifically "resolved.conf"
>>and "resolved.conf.d/*".
>
>On my system the content of the dir is:
>
>$ ls -la /etc/systemd/
>total 64
>drwxr-xr-x   5 root root  4096 Nov  6 03:17 .
>drwxr-xr-x 139 root root 12288 Nov 26 08:20 ..
>-rw-r--r--   1 root root  1282 Aug 21 16:11 journald.conf
>-rw-r--r--   1 root root  1374 Aug 21 16:11 logind.conf
>drwxr-xr-x   2 root root  4096 Apr 12  2016 network
>-rw-r--r--   1 root root   846 Mar 11  2022 networkd.conf
>-rw-r--r--   1 root root   670 Mar 11  2022 pstore.conf
>-rw-r--r--   1 root root  1406 Aug 21 16:11 resolved.conf
>-rw-r--r--   1 root root   931 Mar 11  2022 sleep.conf
>drwxr-xr-x  23 root root  4096 Oct 25 02:41 system
>-rw-r--r--   1 root root  1993 Aug 21 16:11 system.conf
>-rw-r--r--   1 root root   748 Aug 21 16:11 timesyncd.conf
>drwxr-xr-x   5 root root  4096 Oct 11 14:36 user
>-rw-r--r--   1 root root  1394 Aug 21 16:11 user.conf
>
>Note that there is no directory named
>/etc/systemd/resolved.conf.d
>so there is also no place for files there...
>
>Question:
>Can I manually create the dir /etc/systemd/resolved.conf.d and files therein
>such that they will be recognized by the system?

The files are optional, so I suspect the directory is also.

>And if so when are they considered?
>- reboot?
definitely
>- restart of the systemd-resolved service?
definitely

likely also on a "reload".

>- anytime a networking interface is cycled (down/up)?

no idea

>
>>In the latter directory one of my systems has a file
>>"localdns.conf" containing:
>>
>>[Resolve]
>>DNS=10.0.0.12 10.0.0.2 8.8.8.8
>>FallbackDNS=9.9.9.9
>>Domains=jgcomp.com labadie.us jgcomp.org
>
>If that could work then I can actually rescue the system by creating the extra
>file with the wanted DNS servers listed...
>I will try this if I get a confirmation on the issues above.
>
>>

-- 
Jon H. LaBadie                  ubu at labadie.us



More information about the ubuntu-users mailing list