Jammy upstream snapshot and new patch#6719
Conversation
-made sure test case classes don't inherit from TestCase -used pytest fixtures instead of unittest setUp method -converted all self.assert to plain assert. Related canonicalGH-6427
disable-sshd-keygen-if-cloud-init-active.conf seems to have been added twice.
Fix it.
Also replace '/usr/lib/systemd/system' by the macro %{_unitdir} to make the
spec file more portable across distros.
Signed-off-by: Ani Sinha <anisinha@redhat.com>
This is true since FreeBSD 14.0-RELEASE https://www.freebsd.org/releases/14.0R/relnotes/ https://cgit.freebsd.org/src/commit/?id=bbb2d2ce4220
Add test_ds_identify functionality to provide environment variables to tests using PATH_DI_ENV.
) When ephemeral networking is brought up in Azure, the selected interface (`iface`) is `None` under certain conditions. This change introduces a helper function `find_primary_nic()` which uses `net.find_candidate_nics()` to determine and select the system's primary network interface if one is not explicitly set. Additional improvements: - Log the MAC address and driver of the selected NIC for easier debugging. - Ensure the DHCP retry loop updates `iface` to the current primary NIC before retrying to obtain a lease. Fixes canonical#6558
The "has_gnu_date" function checks "date --help" output, but some versions of "date" don't include a "--help" flag.
`time.strftime()` has platform-specific behavior when dealing with a `gmtime()` struct.
It was removed in canonical#6356, but is still needed in some tests that interact with `/tmp`.
Many socket attributes are OS-specific, so ensure we have attributes that work for the tests that need them. Also, mock socket calls where needed.
'echo -n' isn't universal
Note that this test wasn't always Linux-specific, but when the pid stuff moved under Distro, the test was changed to test the base class (i.e., Linux) functionality only.
Implementation differences cause different results.
In DataSourceCloudStack.py, get_newest_lease() is currently being passed a Distro object, causing a Python type error. This PR changes the Distro object to the interface string to fix this error.
Add VM ID to the KVP (Key-Value Pair) event key format to improve telemetry tracking and debugging capabilities for Azure/Hyper-V deployments.
The EC2 datasource checks all NICs one by one to see which can reach the metadata server. This can lead to slow boot if the primary NIC is not checked first. We use the fact that typically the primary NIC on an EC2 instance will be the lowest numbered Elastic interface (either ENA or EFA) and order these first. Only then checking other network devices that may be present. Fixes canonicalGH-6618 Signed-off-by: Zachary Raines <zachary.raines@canonical.com>
…anonical#6554) * Adding case-insensitive options for systemd-networkd leases ("DOMAINNAME", "Domain", "domain-name"). * Falling back gracefully from systemd leases to ISC dhclient leases. * Including dhcpcd ephemeral leases as an additional fallback. * Returning an empty string when no domain name found instead of None for non-fatal missing cases.
When no user is provided in the datasource and root login is not disabled, the root user is configured. Preserve the provided SSH key options from user-data for root user in this case. Before this fix, SSH key options passed in the key line were silently ignored. This is what happens: * `apply_credentials` passes `options=""` to `setup_user_keys`: https://github.com/canonical/cloud-init/blob/25.3/cloudinit/config/cc_ssh.py#L257 * `setup_user_keys` receives the empty parameter and passes it to the `parse` function: https://github.com/canonical/cloud-init/blob/25.3/cloudinit/ssh_util.py#L463 * The `parse` function decides whether options from the key line need to be overridden by the `options` parameter. Treat any falsy `options` parameter should be treated like `None`, otherwise options from the key line are ignored. Fixes: canonicalGH-3868
Init()'s initialization code is self-referential and has runtime ordering that prevents static analysis. Create a property Init.ds which only returns an initialized DataSource. This narrows the possible code paths that mypy must check and makes static (and human) analysis possible.
…nonical#6684) Change the installed ntp client package from ntp to ntpsec when user-data requests `ntp_client: ntp`. Fix inability to install ntp deb packages from universe in Ubuntu for some time which resulted in errors from `cloud-init status` and failed integration tests. Most distributions have migrated away from ntp to ntpsec as replacement implementation which has better security and maintenance as a project. Package migration has happened in many distributions already: - Ubuntu was in Xenial 2016 - OpenSUSE available since 2019 - Fedora 34 2021 - Debian Bookworm 2023 - Alpine 3.10 2019
Also eliminate recommendation to modify datasource_list.
The primary motivation for this extra detail is to capture the flow when multiple DISCOVER requests are required, similar to what we see in dhclient today so we can better understand how time is spent in dhcpcd. Without debug: ``` 2026-01-28 18:19:59,156 - azure.py[DEBUG]: dhcp client stderr for interface=eth0: dhcpcd-10.0.6 starting DUID 00:01:00:01:31:0d:0f:cd:60:45:bd:86:6f:e1 eth0: IAID bd:86:6f:e1 eth0: soliciting a DHCP lease eth0: offered 10.0.0.4 from 168.63.129.16 LVL101082702015SOC eth0: leased 10.0.0.4 for infinity eth0: adding route to 10.0.0.0/16 eth0: adding default route via 10.0.0.1 eth0: adding host route to 168.63.129.16 via 10.0.0.1 eth0: adding host route to 169.254.169.254 via 10.0.0.1 ``` With debug: ``` 2026-01-28 19:52:56,822 - performance.py[DEBUG]: Running ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--debug', '--script=/bin/true', 'eth0'] took 0.128 seconds 2026-01-28 19:52:56,822 - azure.py[DEBUG]: dhcp client stdout for interface=eth0: 2026-01-28 19:52:56,822 - azure.py[DEBUG]: dhcp client stderr for interface=eth0: dhcpcd-10.0.6 starting spawned manager process on PID 527 chrooting as dhcpcd to /usr/lib/dhcpcd sandbox: seccomp spawned privileged proxy on PID 528 spawned controller proxy on PID 529 eth0: executing: /bin/true PREINIT eth0: executing: /bin/true CARRIER DUID 00:01:00:01:31:0d:25:98:60:45:bd:86:6f:e1 eth0: IAID bd:86:6f:e1 eth0: delaying IPv4 for 0.0 seconds eth0: reading lease: /var/lib/dhcpcd/eth0.lease eth0: soliciting a DHCP lease eth0: spawned BPF BOOTP on PID 535 eth0: sending DISCOVER (xid 0x3793814b), next in 4.6 seconds eth0: offered 10.0.0.4 from 168.63.129.16 LVL101082702015SOC eth0: process BPF BOOTP already started on pid 535 eth0: sending REQUEST (xid 0x3793814b), next in 4.4 seconds eth0: acknowledged 10.0.0.4 from 168.63.129.16 LVL101082702015SOC eth0: leased 10.0.0.4 for infinity eth0: writing lease: /var/lib/dhcpcd/eth0.lease eth0: adding IP address 10.0.0.4/16 broadcast 10.0.255.255 eth0: using Classless Static Routes eth0: adding route to 10.0.0.0/16 eth0: adding default route via 10.0.0.1 eth0: adding host route to 168.63.129.16 via 10.0.0.1 eth0: adding host route to 169.254.169.254 via 10.0.0.1 eth0: executing: /bin/true BOUND forked to background ``` One interesting detail I noticed is that a persistent lease file may be used for reboots and DISCOVER is skipped: ``` 2026-01-28 19:49:57,987 - performance.py[DEBUG]: Running ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--debug', '--script=/bin/true', 'eth0'] took 0.386 seconds 2026-01-28 19:49:57,987 - azure.py[DEBUG]: dhcp client stdout for interface=eth0: 2026-01-28 19:49:57,987 - azure.py[DEBUG]: dhcp client stderr for interface=eth0: dhcpcd-10.0.6 starting chrooting as dhcpcd to /usr/lib/dhcpcd sandbox: seccomp spawned manager process on PID 527 spawned privileged proxy on PID 528 spawned controller proxy on PID 529 DUID 00:01:00:01:31:0d:0f:cd:60:45:bd:86:6f:e1 eth0: executing: /bin/true PREINIT eth0: executing: /bin/true CARRIER eth0: IAID bd:86:6f:e1 eth0: delaying IPv4 for 0.4 seconds eth0: reading lease: /var/lib/dhcpcd/eth0.lease eth0: rebinding lease of 10.0.0.4 eth0: spawned BPF ARP 10.0.0.4 on PID 545 eth0: sending REQUEST (xid 0x3740297a), next in 4.5 seconds eth0: spawned BPF BOOTP on PID 546 eth0: acknowledged 10.0.0.4 from 168.63.129.16 LVL101082702015SOC eth0: leased 10.0.0.4 for infinity eth0: writing lease: /var/lib/dhcpcd/eth0.lease eth0: adding IP address 10.0.0.4/16 broadcast 10.0.255.255 eth0: using Classless Static Routes eth0: adding route to 10.0.0.0/16 eth0: adding default route via 10.0.0.1 eth0: adding host route to 168.63.129.16 via 10.0.0.1 eth0: adding host route to 169.254.169.254 via 10.0.0.1 eth0: executing: /bin/true REBOOT forked to background ``` The --debug option has been around forever for dhcpcd so it should be safe. We can see it the oldest tagged version in git and Ubuntu 14.04's manpage: https://manpages.ubuntu.com/manpages//trusty/man8/dhcpcd-bin.8.html Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Add _integration_common.yml which allows parameterized launches of lxc_container based integration tests. Provide separate daily scheduled integration test runners for jammy, noble, questing and resolute which can also by manually started.
Add a unit test to cover this case. Fixes canonicalGH-6695
cloud-init project now requires full SHA commits instead of tags for all workflows to utilize a more secure policy for CI runners. Any Github actions lacking full SHA pins in workflows/actions will error due to repo prevention policy. Additionally update SHA pins to latest known workflow releases.
…cal#6707) Fixes DNS queries for IP addresses that cause 2+ minute boot delays with systemd 259+. Moves IP detection earlier in is_resolvable() and removes legacy DNS-dependent metadata URL. Fixes canonicalGH-6641
patches: debian/patches/no-single-process.patch debian/patches/retain-ec2-default-net-update-events.patch debian/patches/revert-551f560d-cloud-config-after-snap-seeding.patch debian/patches/status-do-not-remove-duplicated-data.patch debian/patches/status-retain-recoverable-error-exit-code.patch
| From f6a682b50958f7081422d02056db64798bdf97ed Mon Sep 17 00:00:00 2001 | ||
| From: Brett Holman <brett.holman@canonical.com> | ||
| Date: Thu, 5 Feb 2026 16:17:35 +0000 | ||
| Subject: [PATCH] Revert "fix: DNS resolution performance regression during | ||
| local stage (#6707)" | ||
|
|
||
| This reverts commit 72809f8046f7abb5157e864a903cc5cc3c70ecbb. | ||
| --- |
There was a problem hiding this comment.
What is being used to generate this header? It doesn't appear to be DEP 3 compliant. My expectation with quilt patches is seeing keys like the following:
Description: Author: Last-Update: etc. per Ubuntu packaging guide
blackboxsw
left a comment
There was a problem hiding this comment.
Patch diff looks good, but I think we may need to confirm to DEP 3 quilt patch header format for these packaging branches.
git format-patch
Why not? DEP-3 actually allows using git patches.
Unfortunately, gbp doesn't seem capable of generating a DEP-3 patch from a git commit, so Debian's recommended tooling is insufficient for the task. To create a patch from a git commit, this is what I do: git revert $COMMIT
git format-patch -1
git reset --hard HEAD^
quilt push -a
quilt refresh # quilt prefers a slightly different format
quilt pop -a --refresh # but this sequence reliably re-formats it.Manually editing patches doesn't seem like a great use of time when a programmatic solution exists using standard tooling. I'd prefer to call this "good enough" and spend our time elsewhere. The Debian docs (linked from the page you referenced) seems to think it is, and the Ubuntu docs doesn't take a stronger stance than "We recommend that you tag every patch with DEP-3 headers by putting them at the top of patch file." - and as I quoted above, this suffices. |
My mistake, I hadn't been aware of this tooling and had always formerly used I also had overlooked the inclusive conditional
Ok, so instead of manually writing a Description via This PR represents the first divergence from that quilt generated --dep3 header. I'm good with this representation now that I know the source of this header generation is from tooling and not likely something we can be affected by humans and typographical errors. Thanks for the discussion. |
Oops also missed the other patch we've already pushed with this header style: 7b0b2be |
blackboxsw
left a comment
There was a problem hiding this comment.
Ok, side-conversation:
Do we want to encode ordering of patch series into the names of our patch files?:
--- No, not worth the maintenance burden. It's best for us to just use tools that meet our immediate needs (either quilt header --dep3 -e for backports or git format-patch for clean reverts. Our guidance of ordering is easily determined via quilt push -a or just looking at the series file.
So, we don't care that default behavior of git format-patch adds a prefix 0001- based on the patch generated.
|
Thanks for the discussion on this @blackboxsw. |
Additional Context
Mitigate risk of removing the instance-data URL #6707
Test Steps
Merge type