AlmaLinux / cloud-images

Packer templates and other tools for building AlmaLinux images for various cloud platforms.
MIT License
146 stars 48 forks source link

cloud-init fails to apply specified network config. Almalinux 9.2 #149

Closed nanalncux closed 1 month ago

nanalncux commented 1 year ago

Hello. We prepare our almalinux images in a packer for deploying virtual and baremetal hosts from a cloud-provider based on AlmaLinux-9.2-x86_64-minimal.iso. We use cloud-init to deliver user settings. (cloud.cfg, user-data, meta-data). On first boot, I expect the cloud-init-local unit to take the settings from cloud.cfg, and then the cloud-init unit uses the settings from meta-data and user-data. The cloud-init unit has a dependency on the NetworkManager-white-online.service, but this service cannot start correctly, since the NetworkManager cannot apply network settings and initialize interfaces. I found a similar problem in LXC, but unfortunately the suggested solution did not help me. Below I attach the configuration files and log entries.

/etc/sysconfig/network-script/ifcfg-eth0 generated correctly

If you go to the host and sequentially execute cloud-init clean systemctl restart cloud-init network is configured correctly.

How I tried to solve the problem: 1- add bootcmd (as described in this issue) 2 - Use cloud-init v23 3 - edit dependencies and replace cloud-init unit

Maybe this problem has something to do with this cloud-init bug, but it is marked as solved. Using version 23 did not solve my problem.

Tell me what I'm doing wrong. cloud.cfg.txt journalctl-firstboot.log meta-data.txt user-data.txt

nanalncux commented 1 year ago

i found my mistake. Since I used the meta-data template for ubuntu, and it uses netplan as a network manager, my config was missing the directive auto eth0 A working set of configurations is an attachment.

cloud.cfg.txt meta-data.txt user-data.txt

LKHN commented 1 month ago

@nanalncux Hi how the things with the latest (9.4) images and Cloud-init package in it? Do you still face any issues or we can close this issue as solved?

Thanks for following the issue and providing the correct options.