From 9a82720f1c0b6ccbaaa82d59a50e57ce9b50a653 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Fri, 7 Apr 2023 16:15:51 -0600 Subject: [PATCH] cloud-init: prefer netplan to handle all network manager config Cloud-init cannot write directly to /etc/NetworkManager/system-connections because subiquity may need to emit config to /etc/netplan/00-installer.yaml and call netplan apply for autoinstall.network use-cases. When cloud-init's config is written directly to /etc/NetworkManager, neither netplan nor subiquity has knowledge of this config and this results in namespace collisions in NetworkManager due to `netplan-` named connections and `cloud-init` connection ids fighting over which config own a given interface name. Deleting this config overlay allows subiquity to manage all network setup when it needs to with netplan directly. Subiquity already has logic to rename any unwanted netplan configuration when it intends to write cfg and run netplan apply[1]. This should allow subiquity full control of network config when needed. [1] https://github.com/canonical/subiquity/blob/ 92ac6544cdfedfd332d8cd94dbcfad0aab994575/subiquitycore/ controllers/network.py#L267 LP: #2015605 --- live-build/functions | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/live-build/functions b/live-build/functions index a3cbadfd..f16c9445 100644 --- a/live-build/functions +++ b/live-build/functions @@ -1008,17 +1008,18 @@ network: version: 2 renderer: NetworkManager EOF - - # inform cloud-init of the same (LP: #1982855) - mkdir -p chroot/etc/cloud/cloud.cfg.d - cat < chroot/etc/cloud/cloud.cfg.d/99-installer-use-networkmanager.cfg -${AUTOMATION_HEADER} -# Let NetworkManager manage all devices on this system -system_info: - network: - renderers: ['network-manager'] - activators: ['network-manager'] -EOF + # Do not limit cloud-init renderers to network-manager as suggested + # in LP: #1982855 because subiquity needs to render full networking + # in ephemeral boot time when autoinstall.network is provided. + # Neither subiquity nor netplan is aware of /etc/NetworkManager config + # artifacts emmitted by cloud-init. It's best if cloud-init reports + # network config directly to /etc/netplan with the configured netplan + # backend: NetworkManager per 01-network-manager-all.yaml above. + + # cloud-init's default renderer discovery will prefer netplan. + # Any time subiquity needs to write and apply network config + # it disables all previous network config in /etc/netplan so + # any previous 50-cloud-init.yaml will be rendered inert. # Position cloud-init.service After=NetworkManager.service. # (LP: #2008952).