Dietpi-config DNS settings not persisting

Creating a bug report/issue

Required Information

  • DietPi version | _DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=11
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘not applicable’
  • Distro version | bullseye 0
  • Kernel version | Linux RPi-4 5.15.76-v8+ #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 aarch64 GNU/Linux
  • SBC model | RPi 4 Model B (aarch64)
  • Power supply used | PoE
  • SD card used | SAMSUNG EVO

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
  • Was the software title installed freshly or updated/migrated?
  • Can this issue be replicated on a fresh installation of DietPi?
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | Reference code: af5cc7a0-c74e-461b-a889-2bd9dad3927b

Steps to reproduce

When I go to dietpi-config and change my DNS settings it won’t take the new settings. After applying the changes Ethernet details show all 0s for all entries. After restarting the RPi it goes back to it’s old settings (IP, MASK, DNS, Gateway). It will not retain the new DNS selected from the list.

  1. dietpi-config
  2. 7: Network Options: Adapters
  3. Ethernet
  4. Change Mode: DHCP to STATIC
  5. Copy: Copy current address to static
  6. Static DNS
  7. Select Quad9
  8. Apply: Save all changes and restart networking.
  9. OK
  10. Skip

Expected behaviour

  • New network settings including new DNS settings should persist.

Actual behaviour

  • After restarting the RPi, it goes back to it’s old settings.

Extra details

Can you check following before and after reboot

cat /etc/network/interfaces

Before Restart (DHCP)

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Ethernet
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.1.74
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 192.168.1.71 192.168.1.72

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.1.71 192.168.1.72
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

After Switching to STATIC with Quad9 DNS settings:

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.74
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.1.71 192.168.1.72
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

After Reboot:

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.74
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.1.71 192.168.1.72
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

It seems that it is persisting within. But when you go back to dietpi-config for some reason it’s showing the old DNS settings.

can you share following after changing to STATIC and after reboot. This is where DNS configuration is done.

cat /etc/resolv.conf
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
domain lan
nameserver 192.168.1.71
nameserver 192.168.1.72
# /etc/resolv.conf.tail can replace this line

I switched to STATIC and selected Quad9 for DNS. Rebooted and these are the results. Looks after all the changes are NOT persistent. For some reason it keeps reverting back to what is advertised by the DHCP.

You still have a DHCP daemon installed replacing your configuration

Try to purge it

apt autopurge dhcpcd5

As well due to PiVPN installed? I checked their installer and they install dhcpcd5 on Raspbian (our ARMv6 RPi image) since a long time, on Debian since a shorter while (to support RPi OS 64-bit). I’ll open a PR to replace the condition which whether dhcpcd is actually installed, to not mess with the systems network stack.

This is correct, I do have PiVPN installed. I installed it via dietpi-software. Is it safe to still purge dhcp5 and keep PiVPN functionality?

Yes it’s safe. This is only for convenience, so RPi OS users do not need to setup a static IP manually, but messes with other network stacks, like ifupdown, which we use.

Done with: Beta v8.12.1 by MichaIng · Pull Request #5984 · MichaIng/DietPi · GitHub
Release will be done the next minutes.

1 Like

Awesome! Thanks for the great work guys!!

1 Like