canonical / canonical/cloud-init
Centos image does not get dns_nameservers configured when the config is picked from initramfs
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
e are trying to boot ephemerally a Centos8 image with MAAS but we have a failure in cloud-init. I see cloud init retrieves the config from initramfs but apparently it fails to configure the dns_servers (if we try with ubuntu we see that the flow is exactly the same but the dns_nameservers are properly configured - we have the same initramfs). I've uploaded the full cloud-init for Centos8 [here](https://pastebin.ubuntu.com/p/v5mJ3Q2KNP/).
as you can see in the logs I've got
```
Applying network configuration from initramfs bringup=False: {'config': [{'type': 'physical', 'name': 'enp5s0', 'subnets': [{'type': 'dhcp', 'control': 'manual', 'netmask': '255.255.255.0', 'broadcast': '10.0.2.255', 'gateway': '10.0.2.254', 'dns_nameservers': ['10.0.1.18', '10.0.2.254'], 'dns_search': ['maas.']}], 'mac_address': '00:16:3e:48:c4:12'}], 'version': 1}
```
But looking at /etc/sysconfig/network-scripts/ifcfg-enp5s0 I have only
```
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp5s0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=dhcp
DEVICE=enp5s0
HWADDR=00:16:3e:48:c4:12
ONBOOT=no
TYPE=Ethernet
USERCTL=no
```
with no dns_nameservers.
## Steps to reproduce the problem
We are developing a feature in MAAS that will allow the user to deploy a Centos8 image ephemerally. The base image can be found [here](http://images.maas.io/ephemeral-v3/stable/centos/8/amd64/20211104_01/) and the kernel being used [here](http://images.maas.io/ephemeral-v3/stable/jammy/amd64/20230328/ga-22.04/generic/). The cmdline is `BOOT_IMAGE=(http,10.0.2.254:5248)/images/centos/amd64/generic/8/stable/boot-kernel nomodeset root=tar:http://10.0.2.254:12345/image.tgz ip=::::vm01:BOOTIF ip6=off cc:{datasource_list: [MAAS]}end_cc cloud-config-url=http://10-0-2-0--24.maas-internal:5248/MAAS/metadata/latest/by-id/7hxgbw/?op=get_preseed log_host=10.0.2.254 log_port=5247 nvme-core.multipath=0 --- BOOTIF=01-00:16:3e:48:c4:12`
## Environment details
- Cloud-init version: 20.3-10.el8_4.5
- Operating System Distribution: Centos8
- Cloud provider, platform or installer type: MAAS
## cloud-init logs
[cloud-init.tar.gz](https://github.com/canonical/cloud-init/files/12542526/cloud-init.tar.gz)
Contributor guide
Assessment
This issue has not been assessed yet.