Skip to content

cloud-init incorrectly always uses sysconfig as the Network Renderer for RHEL9 #5612

Description

@chewborg

Bug report

Since RHEL 9 the default storage of network configurations is now NetworkManager keyfiles, not sysconfig network ifcfg files.
https://www.redhat.com/en/blog/rhel-9-networking-say-goodbye-ifcfg-files-and-hello-keyfiles
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/9.0_release_notes/index#enhancement_networking

However a change to the decision evaluation on which network renderer to use now causes sysconfig to be used in all cases, rather than the expected network-manager renderer.
Issue 4131
Pull Request 4132
This is because the RHEL9 NetworkManager package also always includes the file /usr/lib64/NetworkManager/*/libnm-settings-plugin-ifcfg-rh.so, now used as the inescapable determination of whether to use the sysconfig or network-manager renderers, though using NetworkManager keyfiles now is the default.

So cloud-init is overriding the default behaviour and the result is a RHEL9 OS configured with cloud-init is in an unexpect state. Which is the Interfaces are managed by NetworkManager as ifcfg files in /etc/sysconfig/network-scripts/ rather than the expected keyfiles in /etc/NetworkManager/system-configurations/

Additional steps then need to be undertaken to migrate these configurations to keyfile format.

We expect to find the default state for RHEL9 Networking when using an unmodified cloud-config, and there does not appear to be a way for overriding this except to add a custom renderer list in /etc/cloud/cloud.cfg.d/ excluding sysconfig in custom images.

Steps to reproduce the problem

  1. On a RHEL9 or Rocky9 OS, install the default cloud-init package from the RHEL repos.
  2. Use the image created from this instance in Openstack to create a new VM.
  3. It will always create the Interfaces backend as /etc/sysconfig/network-scripts/ifcfg-{intf}

Environment details

  • Cloud-init version: 23.4-7.el9_4.3
  • Operating System Distribution: RHEL9, Rocky9
  • Cloud provider, platform or installer type: Openstack
[root@rhel-as9-tc6k log]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.4 (Plow)
[root@rhel-as9 log]# cat /etc/sysconfig/network-scripts/readme-ifcfg-rh.txt 
NetworkManager stores new network profiles in keyfile format in the
/etc/NetworkManager/system-connections/ directory.

Previously, NetworkManager stored network profiles in ifcfg format
in this directory (/etc/sysconfig/network-scripts/). However, the ifcfg
format is deprecated. By default, NetworkManager no longer creates
new profiles in this format
...

cloud-init logs

2024-07-15 20:20:17,714 - subp.py[DEBUG]: Running command ['ip', '-6', 'addr', 'show', 'permanent', 'scope', 'global'] with allowed return codes [0]
 (shell=False, capture=True)
2024-07-15 20:20:17,718 - subp.py[DEBUG]: Running command ['ip', '-4', 'addr', 'show'] with allowed return codes [0] (shell=False, capture=True)
2024-07-15 20:20:17,723 - __init__.py[DEBUG]: Detected interfaces {'lo': {'downable': False, 'device_id': None, 'driver': None, 'mac': '00:00:00:00:
00:00', 'name': 'lo', 'up': True}, 'eth0': {'downable': True, 'device_id': '0x0001', 'driver': 'virtio_net', 'mac': 'fa:16:3e:5c:c0:52', 'name': 'et
h0', 'up': False}}
2024-07-15 20:20:17,723 - __init__.py[DEBUG]: no work necessary for renaming of [['fa:16:3e:5c:c0:52', 'eth0', 'virtio_net', '0x0001']]
2024-07-15 20:20:17,723 - stages.py[INFO]: Applying network configuration from ds bringup=False: {'version': 1, 'config': [{'type': 'physical', 'mtu': 1500, 'subnets': [{'type': 'dhcp4'}], 'mac_address': 'fa:16:3e:5c:c0:52', 'name': 'eth0'}, {'type': 'nameserver', 'address': '10.26.2.2'}, {'type': 'nameserver', 'address': '10.26.3.192'}, {'type': 'nameserver', 'address': '10.26.3.21'}, {'type': 'nameserver', 'address': '10.26.3.144'}]}
2024-07-15 20:20:17,724 - util.py[DEBUG]: Writing to /run/cloud-init/sem/apply_network_config.once - wb: [644] 23 bytes
2024-07-15 20:20:17,725 - util.py[DEBUG]: Restoring selinux mode for /run/cloud-init/sem/apply_network_config.once (recursive=False)
2024-07-15 20:20:17,726 - util.py[DEBUG]: Restoring selinux mode for /run/cloud-init/sem/apply_network_config.once (recursive=False)
2024-07-15 20:20:17,729 - __init__.py[DEBUG]: Selected renderer 'sysconfig' from priority list: ['sysconfig', 'eni', 'netplan', 'network-manager', 'networkd']
2024-07-15 20:20:17,733 - util.py[DEBUG]: Writing to /etc/sysconfig/network-scripts/ifcfg-eth0 - wb: [644] 176 bytes
2024-07-15 20:20:17,734 - util.py[DEBUG]: Restoring selinux mode for /etc/sysconfig/network-scripts/ifcfg-eth0 (recursive=False)
2024-07-15 20:20:17,735 - util.py[DEBUG]: Restoring selinux mode for /etc/sysconfig/network-scripts/ifcfg-eth0 (recursive=False)
2024-07-15 20:20:17,735 - util.py[DEBUG]: Reading from /etc/resolv.conf (quiet=False)
2024-07-15 20:20:17,735 - util.py[DEBUG]: Read 55 bytes from /etc/resolv.conf
2024-07-15 20:20:17,735 - util.py[DEBUG]: Writing to /etc/resolv.conf - wb: [644] 198 bytes
2024-07-15 20:20:17,736 - util.py[DEBUG]: Restoring selinux mode for /etc/resolv.conf (recursive=False)
2024-07-15 20:20:17,737 - util.py[DEBUG]: Restoring selinux mode for /etc/resolv.conf (recursive=False)
2024-07-15 20:20:17,738 - util.py[DEBUG]: Writing to /etc/NetworkManager/conf.d/99-cloud-init.conf - wb: [644] 72 bytes
2024-07-15 20:20:17,738 - util.py[DEBUG]: Restoring selinux mode for /etc/NetworkManager/conf.d/99-cloud-init.conf (recursive=False)
2024-07-15 20:20:17,739 - util.py[DEBUG]: Restoring selinux mode for /etc/NetworkManager/conf.d/99-cloud-init.conf (recursive=False)
2024-07-15 20:20:17,739 - util.py[DEBUG]: Writing to /etc/udev/rules.d/70-persistent-net.rules - wb: [644] 96 bytes
2024-07-15 20:20:17,739 - util.py[DEBUG]: Restoring selinux mode for /etc/udev/rules.d/70-persistent-net.rules (recursive=False)
2024-07-15 20:20:17,740 - util.py[DEBUG]: Restoring selinux mode for /etc/udev/rules.d/70-persistent-net.rules (recursive=False)
2024-07-15 20:20:17,740 - util.py[DEBUG]: Reading from /etc/sysconfig/network (quiet=True)
2024-07-15 20:20:17,740 - util.py[DEBUG]: Read 37 bytes from /etc/sysconfig/network
2024-07-15 20:20:17,740 - util.py[DEBUG]: Writing to /etc/sysconfig/network - wb: [644] 107 bytes
2024-07-15 20:20:17,742 - util.py[DEBUG]: Restoring selinux mode for /etc/sysconfig/network (recursive=False)
2024-07-15 20:20:17,742 - util.py[DEBUG]: Restoring selinux mode for /etc/sysconfig/network (recursive=False)
2024-07-15 20:20:17,743 - __init__.py[DEBUG]: Not bringing up newly configured network interfaces
2024-07-15 20:20:17,743 - main.py[DEBUG]: [local] Exiting. datasource DataSourceOpenStackLocal [net,ver=2] not in local mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlynewAn issue that still needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions