DietPi-Automation - DNS nameserver, APT proxy and specific packages to install

I have a few questions about the DietPi-Automation process.

#1 - shell user@hostname
On first boot, the shell keep the default hostname DietPi
Instead of the one I used over AUTO_SETUP_NET_HOSTNAME

A simple reboot solve this.

#2 - nameserver ( local file vs TUI)
I use the AUTO_SETUP_NET_STATIC_DNS to set my local dns resolver.
The result into resolv.conf is ok and dig use it as well.

However, the diet-config / Network Options: Adapters / Ethernet report me the wrong Static DNS .
Static DNS : []

#3 - APT / deb packages
Could dietpi.txt has a variable to set the APT proxy,
and no the System-wide proxy is to …wide for me =)

Is it possible to use dietpi.txt to install software like … dnsutils tree hdparam ?

Thanks !


#1 - shell user@hostname

This is as expected I guess because the host name change would need to be activated. Similar would happen if you would change host name via dietpi-config.

#2 - nameserver ( local file vs GUI)

can you share content of cat /etc/network/interfaces

Is it possible to use dietpi.txt to install software like … dnsutils tree hdparam ?

Basically you could setup a customer to have it executed during initial boot/setup. This way you could install additional software if required.

# Custom Script (post-networking and post-DietPi install)
# - Allows you to automatically execute a custom script at the end of DietPi install.
# - Option 0 = Copy your script to /boot/ and it will be executed automatically.
# - Option 1 = Host your script online, then use e.g. AUTO_SETUP_CUSTOM_SCRIPT_EXEC= and it will be downloaded and executed automatically.
# - Executed script log: /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
  • /etc/network/interfaces
root@pik8s1:~# cat /etc/network/interfaces
# 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

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  • resolv.conf
root@pik8s1:~# cat /etc/resolv.conf 

I will give a try on Custom Script to set the apt proxy and costum deb install.


you have set STATIC IP but DNS entry is hashed (not used)


Let’s check how DNS config looks like and if there are any drop-in files

head -n -0 /etc/resolv.conf 
head -n -0 /etc/resolvconf/resolv.conf.d/*

Custom Script work great !

I installed the apt proxy like this

echo 'Acquire::http::Proxy "http://192.168.xx.yy:3128";' > /etc/apt/apt.conf.d/02proxy.conf

Then others deb files … apt-utils seam mandatory to install dnsutils …
Maybe I should fall back on the old school apt-get instead.

# deb packages
sudo apt install apt-utils  -y 
sudo apt install dnsutils tree  -y


/etc/resolv.conf is a static file

root@pik8s2:~# head -n -0 /etc/resolv.conf 

root@pik8s2:~# head -n -0 /etc/resolvconf/resolv.conf.d/*
head: cannot open '/etc/resolvconf/resolv.conf.d/*' for reading: No such file or directory

Last question for today … where could I set my domain name over dietpi ?

I don’t see inside /etc/hosts neither any search reference into /etc/resolv.conf
hostnamectl give a error while using Failed to create bus connection: No such file or directory
dnsdomainname return nothing ( of course )

Thanks again

You mean the systems local hostname?
dietpi-config > Security Options > Change Hostname

This will change /etc/hostname and /etc/hosts accordingly.

Fits better into network options, actually, doesn’t it?

The public domain/hostname is not affected of this, of course, but a question of your public DNS or DDNS provider only.

hostnamectl is used to manage systemd-hostnamed, which is not used by default on DietPi and Debian in general. Ubuntu uses it in combination with systemd-networkd, which is a different basic network stack, not using /etc/network/interfaces at all.

resolvconf btw is an alternative to systemd-hostnamed, often found on Debian, but not installed by default on DietPi since a while. This is the reason why /etc/resolv.conf is a static file and /etc/network/interfaces does not contain (does not support) the dns-nameservers entry. When resolvconf is installed manually, or as dependency, e.g. along with Pi-hole or when using WireGuard as client, dietpi-config will automatically switch to set the static DNS via dns-nameservers in /etc/network/interfaces instead of writing it to /etc/resolv.conf directly.

I guess question is why dietpi-config is displaying the hashed dns-nameservers and not the value set inside /etc/resolv.conf

Hope I understood the requestor correctly.

Oh yes that is a good question and should be adjusted. Both match if the dns-nameserver entry is effective, but if not, /etc/resolv.conf is what is used by the underlying DNS resulting system library.


Thanks for this explication. Nice details.
I would like to see a real fqdn into my /etc/hosts and a valid answer from the hostname -f / domain.  thishost

setting a FQDN is not something DietPi will do at the moment as DietPi did not know anything on your domain :wink:

Actually I was thinking about adding a public domain/FQDN setting to /boot/dietpi.txt. It is required for some software installs (where we now ask interactively), can enhance other installs (when server name is checked against request hostname of client, like in ownCloud + Nextcloud) and can be used as default input and set as result of dietpi-letsencrypt and dietpi-ddns as well.

Based on that, a dietpi-letsencrypt CLI would allow further automation, and it allows to have the FQDN added automatically to /etc/hosts as alias for the local hostname (if both do not match) or the other way round.

any change to add domain/FQDN setting to /boot/dietpi.txt ?
I do a fresh install of my homelab and I need a fqdn inside /etc/hosts.
Nice DietPi/dietpi.txt update btw.


Currently there is no plan to have it implemented on short notice.

Thanks for this quick answer.
Will do under the hood.