From bcd39308a7e80e89ee3f82062cfcfbd2887c2560 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Wed, 7 Jul 2021 11:07:48 -0400 Subject: [PATCH] 35coreos-live: stop overriding NetworkManager-wait-online timeout to 5s We originally did this in #326 because we wanted to support booting the live ISO without networking. This was solved on the initramfs side by the conditional networking work (#426). But for the real root, this was still useful because if booting the ISO interactively on a system without any network, or a non-DHCP network, we didn't want the user to have to wait until the service timed out before getting a shell. The core issue however is that we're requesting `network-online.target` at all. It's an "active unit" which means that it's only pulled in the transaction, possibly delaying boot, if another systemd unit needs it. And ideally, no service would need it as per: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ In our case, this unit was fedora-coreos-pinger. We drop that requirement here: https://github.com/coreos/fedora-coreos-pinger/pull/41 With that, we no longer pull in `network-online.target` and so no longer delay reaching the console even if NetworkManager isn't able to get an active connection for whatever reason. This matches how it works on traditional Fedora as well. Having a short timeout actually also had a counterproductive effect in the automated install case. There, `coreos-installer.service` does pull in `network-online.target` (which with https://github.com/coreos/coreos-installer/pull/565 we could consider dropping as advised by systemd, though we probably should bump the number of retries some more in that case), but because of the short timeout, we genuinely may not yet have the network fully up before we run (see https://bugzilla.redhat.com/show_bug.cgi?id=1967483). (cherry picked from commit dd54e8cb1aa93420cbdd714dcd2376962c5b86a3) --- ...liveiso-reconfigure-nm-wait-online.service | 23 ------------------- .../modules.d/35coreos-live/live-generator | 2 -- .../modules.d/35coreos-live/module-setup.sh | 3 --- tests/kola/misc-ro | 8 +++++++ 4 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-liveiso-reconfigure-nm-wait-online.service diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-liveiso-reconfigure-nm-wait-online.service b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-liveiso-reconfigure-nm-wait-online.service deleted file mode 100644 index 1c910a2eeb..0000000000 --- a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-liveiso-reconfigure-nm-wait-online.service +++ /dev/null @@ -1,23 +0,0 @@ -# Configure NetworkManager-wait-online in the real root for the -# Live ISO to timeout quicker and also not explicitly fail since -# booting the Live ISO without network is a valid use case. -# -# Doing this improves the user experience when booting the -# Live ISO without network. - -[Unit] -Description=Reconfigure NetworkManager-wait-online service -DefaultDependencies=no -# Make sure we are in the initramfs and we are booted to the live ISO -ConditionPathExists=/usr/lib/initrd-release -ConditionKernelCommandLine=coreos.liveiso -ConditionPathExists=/run/ostree-live - -[Service] -Type=oneshot -RemainAfterExit=yes -# Note keep this in sync with NetworkManager-wait-online.service -# Right now we are keeping the same ExecStart but we are making it -# OK to fail (`-`) and timeout sooner (5 seconds vs 30). -ExecStartPre=/usr/bin/mkdir -p /run/systemd/system/NetworkManager-wait-online.service.d -ExecStart=/bin/bash -c 'echo -e "[Service]\nExecStart=\nExecStart=-/usr/bin/nm-online -s -q --timeout=5" > /run/systemd/system/NetworkManager-wait-online.service.d/liveiso.conf' diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator index fec5860061..9ca1f2bdfe 100755 --- a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator +++ b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator @@ -31,8 +31,6 @@ add_requires sysroot.mount initrd-root-fs.target add_requires sysroot-etc.mount initrd-root-fs.target add_requires sysroot-var.mount initrd-root-fs.target -add_requires coreos-liveiso-reconfigure-nm-wait-online.service initrd.target - mkdir -p "${UNIT_DIR}/ostree-prepare-root.service.d" cat > "${UNIT_DIR}/ostree-prepare-root.service.d/10-live.conf" <