apt: bypass apt-helper wait-online on multi-NIC systems

apt-daily-upgrade.service uses `apt-helper wait-online` as an ExecStartPre
step. On multi-NIC systems with systemd-networkd this helper directly calls
systemd-networkd-wait-online in strict mode, waiting for all managed links
to become online.

On boards with multiple Ethernet ports where some interfaces are commonly
unplugged, this results in repeated timeouts and causes
apt-daily-upgrade / unattended-upgrades to abort, even when at least one
interface is already fully routable.

Replace the ExecStartPre step with a direct invocation of
systemd-networkd-wait-online using `--any`, allowing the service to proceed
as soon as one interface is online.

This preserves the intent of waiting for network availability while making
the behavior robust on multi-NIC and router-style systems.
This commit is contained in:
Igor Pecovnik 2026-01-30 20:41:20 +01:00 committed by Igor
parent f12ac15a65
commit 4128ef0a83
2 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,3 @@
[Service]
ExecStartPre=
ExecStartPre=/lib/systemd/systemd-networkd-wait-online --any --timeout=60

View File

@ -44,6 +44,13 @@ function pre_install_kernel_debs__configure_systemd_networkd() {
mkdir -p "${networkd_wait_online_override_dst_folder}" # This doesn't exist by default, create it
run_host_command_logged cp -v "${networkd_wait_online_override_src_folder}"* "${networkd_wait_online_override_dst_folder}"
# since daily upgrade is not calling systemd-networkd-wait-online.service (but it should) we need to patch that service too
local apt_daily_upgrade_service_override_src_folder="${EXTENSION_DIR}/config-networkd/systemd/system/apt-daily-upgrade.service.d/"
local apt_daily_upgrade_service_override_dst_folder="${SDCARD}/etc/systemd/system/apt-daily-upgrade.service.d/"
mkdir -p "${apt_daily_upgrade_service_override_dst_folder}" # This doesn't exist by default, create it
run_host_command_logged cp -v "${apt_daily_upgrade_service_override_src_folder}"* "${apt_daily_upgrade_service_override_dst_folder}"
# Change the file permissions according to https://netplan.readthedocs.io/en/stable/security/
chmod -v 600 "${SDCARD}"/etc/netplan/*
}