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

Having issues with your DietPi installation or found a bug? Post it here.
vonloschz
Posts: 39
Joined: Wed Apr 21, 2021 4:30 pm

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

Post by vonloschz »

Hello
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 : [9.9.9.9 149.112.112.112]


#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 !
User avatar
Joulinar
Posts: 5927
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

Hi
#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.

Code: Select all

# 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/Automation_Custom_Script.sh and it will be executed automatically.
# - Option 1 = Host your script online, then use e.g. AUTO_SETUP_CUSTOM_SCRIPT_EXEC=https://myweb.com/myscript.sh and it will be downloaded and executed automatically.
# - Executed script log: /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
AUTO_SETUP_CUSTOM_SCRIPT_EXEC=0
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
vonloschz
Posts: 39
Joined: Wed Apr 21, 2021 4:30 pm

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

Post by vonloschz »

* /etc/network/interfaces

Code: Select all

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
address 192.168.66.31
netmask 255.255.255.0
gateway 192.168.66.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.66.31
netmask 255.255.255.0
gateway 192.168.66.1
#dns-nameservers 9.9.9.9 149.112.112.112
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
* resolv.conf

Code: Select all

root@pik8s1:~# cat /etc/resolv.conf 
nameserver 192.168.66.1
vonloschz
Posts: 39
Joined: Wed Apr 21, 2021 4:30 pm

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

Post by vonloschz »

I will give a try on Custom Script to set the apt proxy and costum deb install.
Thanks.
User avatar
Joulinar
Posts: 5927
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

Hi,

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

Code: Select all

#dns-nameservers 9.9.9.9 149.112.112.112
Let's check how DNS config looks like and if there are any drop-in files

Code: Select all

head -n -0 /etc/resolv.conf 
head -n -0 /etc/resolvconf/resolv.conf.d/*
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
vonloschz
Posts: 39
Joined: Wed Apr 21, 2021 4:30 pm

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

Post by vonloschz »

Custom Script work great !

I installed the apt proxy like this

Code: Select all

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.

Code: Select all

# deb packages
sudo apt install apt-utils  -y 
sudo apt install dnsutils tree  -y 
vonloschz
Posts: 39
Joined: Wed Apr 21, 2021 4:30 pm

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

Post by vonloschz »

About the AUTO_SETUP_NET_STATIC_DNS

/etc/resolv.conf is a static file

Code: Select all

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

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
vonloschz
Posts: 39
Joined: Wed Apr 21, 2021 4:30 pm

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

Post by vonloschz »

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
User avatar
MichaIng
Site Admin
Posts: 3349
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

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.
User avatar
Joulinar
Posts: 5927
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

@MichaIng
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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply