How to disable auto-updates of /etc/hostsname, /etc/resolv.conf (& maybe others)?

johnnyutahh

Member
Sep 19, 2020
31
7
8
39
PVE newbie here.

How do I disable the following "auto-change-files upon startup" behavior?

I have very-specific settings in /etc/hostname and /etc/resolv.conf (read: I know what I'm doing) in my Ubuntu 20.04 LXC container. PVE appears to be auto-changing values in these files upon every container restart/bootup. I have already removed the rdnssd resolvconf network-manager packages that tend to automatically-change files like the ones above.

PLS NOTE: I want to _keep_ the auto-configure-upon-creation behavior.

Also: how is this control (of files mentioned in the wiki reference below) different between LXC containers and kvm-based VMs?

A potentially-helpful reference:
https://pve.proxmox.com/wiki/Linux_Container#_guest_operating_system_configuration
 
Answering my own question (although I've not yet tested it), excerpt from the above-referenced wiki page:

Modification of a file can be prevented by adding a .pve-ignore. file for it. For instance, if the file /etc/.pve-ignore.hosts exists then the /etc/hosts file will not be touched. This can be a simple empty file created via:

# touch /etc/.pve-ignore.hosts

Most modifications are OS dependent, so they differ between different distributions and versions. You can completely disable modifications by manually setting the ostype to unmanaged.
 
Last edited:
I also ran into this after migrating all my LXD Ubuntu containers to Proxmox including a powerDNS container which is a good example why this behaviour is unwanted in some scenarious.

If the container is configured for DHCP I would argue, this is unexpected behaviour.
I don't like Proxmox to handle my network configuration, especially not if containers are set to DHCP.

Is there a way to completely disable this on Proxmox host side instead of touching every container.

I ran into this again after installing tailscale on my proxmox host:
https://tailscale.com/kb/1133/proxmox/
https://www.reddit.com/r/Tailscale/comments/to3wj5/proxmox_and_tailscale_new_lxc_container_have_no/

Code:
sudo rm /etc/resolv.conf && sudo touch /etc/.pve-ignore.resolv.conf
# re-link systemd-resolve file
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
 
  • Like
Reactions: kzaoaai

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!