diff --git a/Makefile b/Makefile index 7664b56b..8d008f8b 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ install: /bin/cp -a static/* $(DESTDIR) mkdir -p $(DESTDIR)/install-data /bin/cp -r $(CRAFT_STAGE)/local-debs $(DESTDIR)/install-data/local-debs + /bin/cp -r patch $(DESTDIR)/install-data # customize set -eux; for f in ./hooks/[0-9]*.chroot; do \ base="$$(basename "$${f}")"; \ diff --git a/hooks/032-apply-patches.chroot b/hooks/032-apply-patches.chroot new file mode 100755 index 00000000..9e040f4d --- /dev/null +++ b/hooks/032-apply-patches.chroot @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eux + +# Apply netplan patch (workaround for LP#2058976 +patch -p0 -i /install-data/patch/netplan-apply.diff diff --git a/patch/netplan-apply.diff b/patch/netplan-apply.diff new file mode 100644 index 00000000..acd11d95 --- /dev/null +++ b/patch/netplan-apply.diff @@ -0,0 +1,31 @@ +--- ./usr/share/netplan/netplan/cli/commands/apply.py 2024-04-19 10:02:42.065447958 +0100 ++++ ./usr/share/netplan/netplan/cli/commands/apply.py 2024-04-19 10:04:34.325809194 +0100 +@@ -270,15 +270,20 @@ + # exclude the special 'netplan-ovs-cleanup.service' unit + netplan_ovs = [os.path.basename(f) for f in glob.glob('/run/systemd/system/*.wants/netplan-ovs-*.service') + if not f.endswith('/' + OVS_CLEANUP_SERVICE)] +- # Run 'systemctl start' command synchronously, to avoid race conditions ++ # Run 'systemctl (re)start' command synchronously, to avoid race conditions + # with 'oneshot' systemd service units, e.g. netplan-ovs-*.service. +- try: +- utils.networkctl_reload() +- utils.networkctl_reconfigure(utils.networkd_interfaces()) +- except subprocess.CalledProcessError: +- # (re-)start systemd-networkd if it is not running, yet +- logging.warning('Falling back to a hard restart of systemd-networkd.service') +- utils.systemctl('restart', ['systemd-networkd.service'], sync=True) ++ # ++ # In the past, calls to networkctl_reload/networkctl_reconfigure ++ # were tried, but due maybe to systemd-networkd bugs, they were not ++ # working as expected: the interface was getting initially the ++ # expected state, but after some minutes it ignored the state of ++ # /run/systemd/network/ and used the configuration read when the ++ # service was started. This happened in the case of removed ++ # .network files. Looking at files in ++ # /run/systemd/netif/links/, the internal state seemed to keep ++ # removed files in NETWORK_FILE= (see LP#2058976). ++ logging.info('Restarting systemd-networkd.service') ++ utils.systemctl('restart', ['systemd-networkd.service'], sync=True) + # 1st: execute OVS cleanup, to avoid races while applying OVS config + utils.systemctl('start', [OVS_CLEANUP_SERVICE], sync=True) + # 2nd: start all other services