From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id DB3861FF066 for ; Tue, 24 Nov 2026 15:57:11 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DC4ED216AA; Tue, 24 Nov 2026 15:57:04 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Subject: [PATCH container/manager/qemu-server 0/6] persist auto-generated MAC addresses of guest network devices Date: Tue, 24 Nov 2026 15:56:44 +0100 Message-ID: <20261124145651.335234-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795532219642 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.185 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: JP6VGDWZWYZZJX7GVHGRNT7TYKPPICUY X-Message-ID-Hash: JP6VGDWZWYZZJX7GVHGRNT7TYKPPICUY X-MailFrom: s.hanreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: A guest network device without a MAC address is valid for qemu-server and pve-container, which generate a random one each time they parse the device. The API always stores one, but manual edits and restored backups can lack it, as can containers created with pve-container 3.0-8 to 3.0-10. Since libpve-cluster-perl 9.1.11, such a container fails to start, as the setup code reads datacenter.cfg from pmxcfs for the random MAC address, from within the container's root: Transport endpoint is not connected error in setup task PVE::LXC::Setup::pre_start_hook Without a persisted MAC address, the guest, the SDN DHCP mapping and cloud-init each use a different random address. So persist a generated MAC address when starting a guest, and when restoring a backup without 'unique', for containers and VMs. Starting such a guest now writes a MAC address into the config. Resuming or live-migrating a VM is intentionally left out, as the VM already runs with the auto-generated MAC address. It needs a cold start for this fix to apply. The last patch keeps the container network panel working for devices without a MAC address. pve-container: Stefan Hanreich (3): setup: do not read datacenter.cfg inside the container's root start: persist a MAC address for network devices without one restore: add missing MAC addresses of the backup config src/PVE/LXC.pm | 7 ++++- src/PVE/LXC/Config.pm | 23 ++++++++++++++-- src/PVE/LXC/Create.pm | 3 +++ src/PVE/LXC/Setup/Alpine.pm | 2 +- src/PVE/LXC/Setup/Base.pm | 2 +- src/PVE/LXC/Setup/CentOS.pm | 4 +-- src/PVE/LXC/Setup/Debian.pm | 2 +- src/PVE/LXC/Setup/Gentoo.pm | 2 +- src/PVE/LXC/Setup/SUSE.pm | 2 +- src/test/config_tests.pl | 53 +++++++++++++++++++++++++++++++++++++ src/test/run_setup_tests.pl | 3 +-- 11 files changed, 91 insertions(+), 12 deletions(-) qemu-server: Stefan Hanreich (2): start: persist a MAC address for network devices without one restore: add missing MAC addresses of the backup config src/PVE/QemuServer.pm | 11 +++++++ src/PVE/QemuServer/Network.pm | 30 ++++++++++++++++++ src/test/Makefile | 5 ++- src/test/run_network_tests.pl | 38 +++++++++++++++++++++++ src/test/run_qemu_restore_config_tests.pl | 18 +++++++++++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100755 src/test/run_network_tests.pl pve-manager: Stefan Hanreich (1): ui: lxc: network: handle network devices without a MAC address www/manager6/lxc/Network.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Summary over all repositories: 17 files changed, 193 insertions(+), 14 deletions(-) -- Generated by murpp 0.12.0