[Merge] ~chad.smith/livecd-rootfs:desktop-cloud-init-after-network-manager-ordering into livecd-rootfs:ubuntu/master
Dimitri John Ledkov
mp+439586 at code.launchpad.net
Mon Mar 27 10:02:04 UTC 2023
Review: Needs Resubmitting improvements for future maintainance
It would be nice to convert this to just the overrides snippet.
Diff comments:
> diff --git a/live-build/functions b/live-build/functions
> index e1f0000..1e81de9 100644
> --- a/live-build/functions
> +++ b/live-build/functions
> @@ -1017,6 +1020,50 @@ system_info:
> activators: ['network-manager']
> EOF
>
> + # Position cloud-init.service After=NetworkManager.service.
> + # (LP: #2008952).
> + # We override the entire cloud-init.service definition because
> + # systemd drop-in files only allow adding Before/After constraints
> + # yet we are dropping the Before=sysinit.target from the upstream
> + # cloud-init.service.
> + # This override can be dropped when NetworkManager.service can run
> + # Before=sysinit.target when it drops strict dbus.service dependency.
> + cat <<EOF > chroot/lib/systemd/system/cloud-init.service
> +${AUTOMATION_HEADER}
> +# Based on cloud-init 23.1 for Desktop LiveCD
> +[Unit]
> +Description=Initial cloud-init job (metadata service crawler)
> +DefaultDependencies=no
> +Wants=cloud-init-local.service
> +Wants=sshd-keygen.service
> +Wants=sshd.service
> +After=cloud-init-local.service
> +After=systemd-networkd-wait-online.service
> +# Installer Added After=NetworkManager* ordering
> +After=NetworkManager.service
> +After=NetworkManager-wait-online.service
> +After=networking.service
> +Before=network-online.target
> +Before=sshd-keygen.service
> +Before=sshd.service
> +# Before=sysinit.target Installer removed to allow for NM dependency
> +Before=shutdown.target
I don't like that this is a full service file, which may get out of sync with parent.
cloud-init.service.d/ snippets allow overriding and removing ordering constraints. I would rather see:
mkdir -p chroot/lib/systemd/system/cloud-init.service.d/
cat <<EOF >chroot/lib/systemd/system/cloud-init.service.d/livecd-rootfs.conf
[Unit]
# clear Before=sysinit.target from cloud-init
Before=
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service
# Add After NetworkManager
After=NetworkManager.service
After=NetworkManager-wait-online.service
After=networking.service
EOF
Also note that
1) After=networking.service is part of ifupdown-like networking stacks that are not used on any ubuntu images, thus it is redundant to order before it, it is non-existing, and thus a no-op.
2) After=NetworkManager.service is redundant, becasue Network-Manager-wait-online.service already requires and is after NetworkManager.service.
> +Conflicts=shutdown.target
> +Before=systemd-user-sessions.service
> +
> +[Service]
> +Type=oneshot
> +ExecStart=/usr/bin/cloud-init init
> +RemainAfterExit=yes
> +TimeoutSec=0
> +
> +# Output needs to appear in instance console output
> +StandardOutput=journal+console
> +
> +[Install]
> +WantedBy=cloud-init.target
> +EOF
> +
> # Allow cloud-init clean to inform of strict network-manager config
> mkdir -p chroot/etc/cloud/clean.d
> cat <<EOF > chroot/etc/cloud/clean.d/99-installer-use-networkmanager
--
https://code.launchpad.net/~chad.smith/livecd-rootfs/+git/livecd-rootfs/+merge/439586
Your team Ubuntu Core Development Team is subscribed to branch livecd-rootfs:ubuntu/master.
More information about the Ubuntu-reviews
mailing list