canonical / cloud-init

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

ConditionEnvironment directive in cloud-init service files is only supported for systemd >=246 #5604

Open anhvoms opened 3 months ago

anhvoms commented 3 months ago

Bug report

ConditionEnvironment directive was recently introduced to cloud-init service files (link). This directive is only supported in systemd starting version 246. Ubuntu 20.04 cloud images only ship with systemd 245. This might cause some confusion for user when troubleshooting issues.

name 'ConditionEnvironment' in section 'Unit', ignoring. [ 106.354546] temp-vm-anhvo-eastus2-t20240812114016 systemd[1]: /lib/systemd/system/cloud-init-local.service:15: Unknown key name 'ConditionEnvironment' in section 'Unit', ignoring. [ 106.369179] temp-vm-anhvo-eastus2-t20240812114016 systemd[1]: /lib/systemd/system/cloud-config.service:8: Unknown key name 'ConditionEnvironment' in section 'Unit', ignoring. [ 106.370195] temp-vm-anhvo-eastus2-t20240812114016 systemd[1]: /lib/systemd/system/cloud-init.target:15: Unknown key name 'ConditionEnvironment' in section 'Unit', ignoring. [ 106.371090] temp-vm-anhvo-eastus2-t20240812114016 systemd[1]: /lib/systemd/system/cloud-final.service:9: Unknown key name 'ConditionEnvironment' in section 'Unit', ignoring.

Steps to reproduce the problem

Deploy latest Ubuntu marketplace images on Azure then check journal log for entries by cloud-init services

Environment details

cloud-init logs

N/A

blackboxsw commented 3 months ago

Thanks @anhvoms for filing the bug and making cloud-init better. I think this issue was also reported in #5402 and should be resolved by 7a2163c281511d7a03e0089931520fb92bcaa9ad and https://github.com/canonical/cloud-init/issues/5402 which is currently queued (and verified) for SRU into 20.04 as cloud-init version: 24.2.

Our cloud-init SRU to Ubuntu Focal, Jammy and Noble is currently blocked on an unrelated bug LP: 2075337 in python3-defaults which impacts cloud-init across deb package upgrade. Expectation is this should publish as fixed to focal this week. Please re-open if this doesn't appear to address this problem.

jazelenk commented 2 months ago

I am still seeing this problem with the latest focal from the marketplace on Azure.

TheRealFalcon commented 2 months ago

Expectation is this should publish as fixed to focal this week.

The fix has taken much longer to publish than anticipated, and so cloud-init is still blocked from releasing the latest version with this fix. Once released with the fix, cloud-init --version should be 24.3 24.2 or later.

aciba90 commented 2 months ago

I think we meant 24.2 instead of 24.3.

jazelenk commented 3 weeks ago

Any update on this? We are still seeing this as of yesterday.

# cloud-init --version
/usr/bin/cloud-init 24.3.1-0ubuntu0~20.04.1
jazelenk commented 2 weeks ago

@TheRealFalcon @aciba90 any thoughts? I'm seeing this on the Azure marketplace image Canonical/0001-com-ubuntu-server-focal/20_04-lts/20.04.202410160

# uname -a
Linux can-01 5.15.0-1074-azure #83~20.04.1-Ubuntu SMP Fri Oct 4 21:49:59 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# cloud-init --version
/usr/bin/cloud-init 24.3.1-0ubuntu0~20.04.1
TheRealFalcon commented 2 weeks ago

@jazelenk , yes it looks like this is still present in 24.3. I'll ensure it is fixed in the next release.

jazelenk commented 1 week ago

Any update on this? Across a fleet, this is consuming a non-trival amount of storage for logs.

aciba90 commented 1 week ago

No more updates. The issue is scheduled to be fixed in cloud-init-24.4, which is scheduled to be performed the 18th of November.