Mask systemd-networkd-wait-online.service during boot (#13611)

Blue committed Nov 20, 2025 at 17:23 UTC f75997128d747c41e65d7a9e6af8f13e738abd44
2 files changed +10
src/linux/init/init.cpp
+4
@@ -329,6 +329,10 @@ int GenerateSystemdUnits(int Argc, char** Argv)
329 File.reset();
330 }
331
332 + // Mask systemd-networkd-wait-online.service since WSL always ensures that networking is configured during boot.
333 + // That unit can cause systemd boot timeouts since WSL's network interface is unmanaged by systemd.
334 + THROW_LAST_ERROR_IF(symlink("/dev/null", std::format("{}/systemd-networkd-wait-online.service", installPath).c_str()) < 0);
335 +
336 // Only create the wslg unit if both enabled in wsl.conf, and if the wslg folder actually exists.
337 if (enableGuiApps && access("/mnt/wslg/runtime-dir", F_OK) == 0)
338 {
test/windows/UnitTests.cpp
+6
@@ -211,6 +211,12 @@ class UnitTests
211
212 auto revert = EnableSystemd();
213 VERIFY_IS_TRUE(IsSystemdRunning(L"--system"));
214 +
215 + // Validate that systemd-networkd-wait-online.service is masked.
216 + auto [out, _] =
217 + LxsstuLaunchWslAndCaptureOutput(L"systemctl status systemd-networkd-wait-online.service | grep -iF Loaded:");
218 +
219 + VERIFY_ARE_EQUAL(out, L" Loaded: masked (Reason: Unit systemd-networkd-wait-online.service is masked.)\n");
220 }
221
222 TEST_METHOD(SystemdUser)