resolv.conf overwritten at every debian container restart

puterfixer

New Member
Feb 13, 2024
3
0
1
Hi everyone,

Getting my feet wet with Proxmox and I'm already stumped after quite a bit of searching for a solution myself.

I have a fresh Proxmox VE 8.1.4 installed and updated, with a debian 12.2-1 container installed and updated, with the intended purpose of a pi-hole.

The container is bound directly to the vmbr0 bridge, so that the virtual switch is an extension of the physical home network, with the router's DHCP and so on.

For IPv4 I have a static IP assigned outside of the router's DHCP range, but for IPv6 the container is set to use DHCP. I have manually configured the DNS entries for the container with servers 1.1.1.1 and 1.0.0.1 .

The problem is that every time the container is restarted, the /etc/resolv.conf file is overwritten (or dynamically regenerated) with a single line for a nameserver with an IPv6 address:
Code:
nameserver fe80::be4c:14ce:feff:c4cb%eth0

I tried to manually modify /etc/network/interfaces to add the two explicit dns-nameserver lines for eth0 and this file is not getting overwritten at restart, but its directives also do not apply.

If I change the network setting with a static IPv6 address and don't specify one, then the file no longer gets overwritten.

Is this a bug? Am I doing something wrong?

Many thanks in advance!
 
Thanks for the reply, @generalproxuser .

By "a bit of searching for a solution myself" I meant about 5 hours of googling and testing, including the thread you linked.

I already created the file /etc/.pve-ignore.resolv.conf with no change in behavior. This suggested that it's not PVE modifying the file at container startup/restart, but one of the automated scripts in the debian container linked to getting the interface up and receiving an IPv6 assignment over DHCP.

There is no /run/systemd/* . There is a /etc/systemd/ but nothing inside to resemble resolv.conf or resolv. There is a /etc/systemd/networkd.conf which has all settings commented, and a /etc/systemd/network directory that's empty.

There are no rdnssd resolvconf network-manager packages installed. resolvconf is an optional add-on in debian 12. Only systemd is there.

I'll likely scratch myself a bald spot by morning with this... :D
 
The other option (which is what I use in my pihole containers using debian 12) is to create a hook file. I use dhcp as well with static leasing. My pihole containers are using dhcp with static leases. This is what I use.

Create the file:
Code:
/etc/dhcp/dhclient-enter-hooks.d/nodnsupdate

Inside that file add:
Code:
#!/usr/bin/env sh
make_resolv_conf(){
    :
}

Set the file to executable:
Code:
chmod +x /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate

Make whatever changes you want to your resolv.conf file, save the changes, then reboot to see if the changes stick. This is what has worked for me many times over.
 
  • Like
Reactions: puterfixer
I saw that method as well, and although it most likely will produce the results I want, it is an illogical approach to solving the problem. Instead of having a setting or flag that can be defined in a configuration file, we're literally providing new code to override a built-in function which doesn't want to behave in a controlled manner. How is that following the principle of segregating code from configuration, how is that resilient to upgrades, how is that automatable through configuration as code? And most importantly, why is the DHCP for IPv6 completely overwriting the IPv4-related settings?

That's fully a debian problem. As much as I'd like to continue using it after switching from the Raspberry Pi OS (a debian in disguise), I'd rather switch to Ubuntu to see if it can be configured more cleanly, instead of frankensteining the make_resolv_conf function to fix a defect.

At least now I know for sure that the issue is not caused by PVE or some wrong configuration I've put for the container. :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!