Temporary failure in name resolution on Ubuntu server 22.04.3 LTS

Jon LaBadie ubu at labadie.us
Mon Nov 27 17:27:09 UTC 2023


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


>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

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/*".

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


-- 
Jon H. LaBadie                  ubu at labadie.us



More information about the ubuntu-users mailing list