Circular dependency in cloud-init units
Describe the bug
Using photonOS 5 (tested against most recent updates as of today) in VMware vSphere 8, we're seeing a dependency cycle in cloud-init that is causing VMs to randomly fail configuration/customization.
Reproduction steps
- Configure photon OS cloud-init for VMware datasource
- Use vSphere cloud-init based customizations when cloning
Expected behavior
Deployments consistently work. Instead, deployments randomly fail due to systemd detecting dependency cycles related to cloud-init.
Additional context
Logs show detection of circular dependencies, resulting in cloud-init and other services being disabled.
It looks like the dependency cycle is created by sockets.target inherently depending on cloud-init-hotplugd.socket, which then depends on cloud-config.
There was an upstream cloud-init fix https://github.com/canonical/cloud-init/pull/5722 mentioned at https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2081124
There was an upstream cloud-init fix canonical/cloud-init#5722 mentioned at https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2081124
Thanks for pointing out this upstream fix!
I pulled these changes into the cloud-init-hotplugd.socket systemd unit in my VM template, and after about 20 test provisions have not seen this issue occur again.
It looks like once this version of cloud-init is pulled into photon, this bug should be resolved.
This is the year of SRP. That groundwork unleashes many automation benefits. This upstream fix is strange because it hasn‘t been included in the November 2024 version. SRP has static link connectivity for that if I understood the code right. Glad it helped. Back to the Photon OS team.
By default, in vanilla Photon this issue is not there. I doubt some other systemd unit file hosted in your system is causing this failure.