canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.85k stars 852 forks source link

timeout issue related to no network interfaces #5511

Open holmanb opened 1 month ago

holmanb commented 1 month ago

Bug report

Reported by a user on IRC.

I'm booting up a VM with an Ubuntu image set up for cloud-init. I'm not able to modify the image at all pre-boot, but I do have full control over the user-data and other pieces that get passed to cloud-init, via an attached CIDATA drive. The problem is that this image is also configured such that cloud-init depends on systemd's wait-for-online service, and many of the VMs I'm spinning up have no NICs, and therefore will never be online. This causes all these VMs to sit for 2 minutes until the service times out, something I need them to not do. Is there some way I can get cloud-init-local to fix this for me?

Since the timeout happens before the full cloud-init pass things like runcmd or bootcmd won't happen yet, so I can't just mask out the service. I've also tried setting my network config to 'disabled' but that didn't seem to change anything. Would really appreciate any tips or guidance here, as I'm out of ideas.

@TheRealFalcon suggested a potential workaround:

you could try adding a network-config to your NoCloud image. You can see an example here (under the example): https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html#example-meta-data if you list a single interface with "optional: true", I'm wondering if that would work

Steps to reproduce the problem

Environment details

cloud-init logs

smalis-msft commented 1 month ago

Adding a single non-existant interface with optional: true does in fact work around the issue. The config I used for reference:

version: 1
config:
  - type: physical
    name: eth0
    optional: true