Prevent automatic modification of system files in LXC containers (PVE environment) after each restart.

In the PVE environment, when starting an LXC container, PVE will automatically detect the operating system running in the container and automatically modify certain operating system configuration files. Taking Alpine Linux as an example, the following configuration files will be automatically modified:

  • /etc/hostname
  • /etc/hosts
  • /etc/resolv.conf
  • /etc/network/interfaces

After modifying the content of these files, if you don't want PVE to automatically modify them after each restart, you can create an empty file with the name [.pve-ignore.+filename] in the same directory as the file. This way, PVE will not automatically modify the content of this file.
For example:

1. Disable automatic modification of network interface settings by PVE
$ touch /etc/network/.pve-ignore.interfaces

2. Disable automatic modification of DNS settings by PVE
$ touch /etc/.pve-ignore.resolv.conf

3. Disable automatic modification of hostname settings by PVE
$ touch /etc/.pve-ignore.hosts
$ touch /etc/.pve-ignore.hostname

The official documentation is available here:

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.