[Merge] ~chad.smith/livecd-rootfs:desktop-cloud-init-after-network-manager-ordering into livecd-rootfs:ubuntu/master

Chad Smith mp+439586 at code.launchpad.net
Mon Mar 27 20:31:35 UTC 2023


Thanks @xnox. I didn't know that drop-ins would provide the ability to zero-out the Before. Thanks for the tip

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

Excellent suggestion on how to clear out the "Before=" Dmitri. I didn't know how that was possible. I'll provide a followup for this that we should be able to pull in at leisure. I also don't like the full cloud-init.service override here for those same out-of-sync reasons.

> +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