You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OCI: Ubuntu Instance /etc/resolv.conf Is Overwritten at Boot Time

edited Sep 24, 2023 11:41AM in Linux

Applies To:

Oracle Cloud Infrastructure - Version N/A and later

Linux x86-64

Symptoms:

/etc/resolv.conf custom entries get overwritten during boot.

Changes:

Made an nameserver entry of 8.8.8.8 (a public DNS server on the internet) in /etc/resolv.conf, next day its gets automatically removed.

Cause:

This file is managed by systemd-resolved which overwrites the file to default value upon reboot or "netplan apply".

$ sudo cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
...
$

The manual page systemd-resolved.service(8) describes:

/ETC/RESOLV.CONF
       Four modes of handling /etc/resolv.conf (see resolv.conf(5)) are supported:

       ·   systemd-resolved maintains the /run/systemd/resolve/stub-resolv.conf file for compatibility with traditional Linux
           programs. This file may be symlinked from /etc/resolv.conf. This file lists the 127.0.0.53 DNS stub (see above) as
           the only DNS server. It also contains a list of search domains that are in use by systemd-resolved. The list of
           search domains is always kept up-to-date. Note that /run/systemd/resolve/stub-resolv.conf should not be used directly
           by applications, but only through a

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!