photon icon indicating copy to clipboard operation
photon copied to clipboard

Circular dependency in cloud-init units

Open wduncanfraser opened this issue 11 months ago • 4 comments

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.

Screenshot 2025-01-07 at 17 51 47

Reproduction steps

  1. Configure photon OS cloud-init for VMware datasource
  2. 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. Screenshot 2025-01-07 at 17 54 20 Screenshot 2025-01-07 at 17 54 36

It looks like the dependency cycle is created by sockets.target inherently depending on cloud-init-hotplugd.socket, which then depends on cloud-config.

wduncanfraser avatar Jan 07 '25 23:01 wduncanfraser

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

dcasota avatar Jan 08 '25 08:01 dcasota

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.

wduncanfraser avatar Jan 08 '25 16:01 wduncanfraser

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.

dcasota avatar Jan 08 '25 16:01 dcasota

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.

sshedi avatar Feb 10 '25 08:02 sshedi