How to add option to /etc/resolv.conf under systemd?

Tom H tomh0665 at gmail.com
Sun Mar 8 15:48:17 UTC 2020


On Fri, Feb 28, 2020 at 12:09 AM Chris Green <cl at isbd.net> wrote:
> On Thu, Feb 27, 2020 at 04:39:18PM -0600, Wynona Stacy Lockwood wrote:
>> On Thu, Feb 27, 2020 at 4:07 PM Chris Green <[1]cl at isbd.net> wrote:
>>
>> I want to add the option "options single-request" to my
>> /etc/resolv.conf file.  As this file is actually a symlink to a file
>> created dynamically by systemd at startup it isn't immediately
>> obvious
>> how to do this.
>> So, that's the question, how does one add options to
>> /etc/resolv.conf
>> under systemd?
>>
>> Do you have resolvconf installed? If so, you can simply edit the head
>> file, which you should find at /etc/resolvconf/resolv.conf.d/head which
>> you can edit with sudo nano.
>> If you don't have it installed, and wish to use it to help with this,
>> do the following:
>> sudo apt update
>> sudo apt install resolvconf
>> sudo systemctl status resolvconf.service
>> If it's not already running for some reason, do the following:
>> sudo systemctl start resolvconf.service
>> sudo systemctl enable resolvconf.service
>> sudo systemctl status resolvconf.service
>> If that works as expected, you then just do:
>> sudo nano /etc/resolvconf/resolv.conf.d/head
>> and add what you want to the file. Save your changes, and then:
>> sudo systemctl start resolvconf.service
>> At this point, you should basically be done.
>> NEAT find on options single-request! I hadn't seen that before, but it
>> makes a lot of sense, and I'm now using it as well!
>
> Doing that seems to stop the systemd defaults from
> /usr/lib/systemd/resolv.conf from getting installed, is that supposed
> to happen?

You could file a bug report requesting (1) that
"/usr/lib/systemd/resolv.conf" be a "conffile" or (2) that it be
overridden by "/etc/systemd/resolv.conf" if it exists or (3) that the
existence of "/etc/systemd/resolv.conf" lead to the creation of
"/run/systemd/resolve/etc-resolv.conf" (you've have to symlink it to
"/etc/resolv.conf") or (4) that "/etc/systemd/resolved.conf" gain the
ability to add options to "/run/systemd/resolve/resolv.conf".




More information about the ubuntu-users mailing list