Mask NetworkManager-wait-online.service during boot (#14272)
* Mask NetworkManager-wait-online.service during boot Fixes #13772. Similar to PR #13611, this masks NetworkManager-wait-online.service to prevent 60-second timeouts during boot since WSL interfaces are unmanaged by NetworkManager. Also added the service to the discouraged units list in validate-modern.py and added a unit test. * Addressed Copilot feedback * Fix
Dimitris Chatzis committed
Feb 26, 2026 at 03:39 UTC
cb35b511ccf9bedaf0f9f3d9836adc27e93ca8e0
3 files changed
+10
distributions/validate-modern.py
+1
@@ -33,6 +33,7 @@ DISCOURAGED_SYSTEM_UNITS = ['systemd-resolved.service',
33
'systemd-tmpfiles-setup-dev.service',
34
'tmp.mount',
35
'NetworkManager.service',
36
+ 'NetworkManager-wait-online.service',
37
'networking.service',
38
'hypervkvpd.service']
39
src/linux/init/init.cpp
+3
@@ -333,6 +333,9 @@ int GenerateSystemdUnits(int Argc, char** Argv)
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
+ // Mask NetworkManager-wait-online.service for the same reason, as it causes timeouts on distros using NetworkManager.
337
+ THROW_LAST_ERROR_IF(symlink("/dev/null", std::format("{}/NetworkManager-wait-online.service", installPath).c_str()) < 0);
338
+
339
// Only create the wslg unit if both enabled in wsl.conf, and if the wslg folder actually exists.
340
if (enableGuiApps && access("/mnt/wslg/runtime-dir", F_OK) == 0)
341
{
test/windows/UnitTests.cpp
+6
@@ -217,6 +217,12 @@ class UnitTests
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
+ // Validate that NetworkManager-wait-online.service is masked.
222
+ auto [outNm, __] =
223
+ LxsstuLaunchWslAndCaptureOutput(L"systemctl status NetworkManager-wait-online.service | grep -iF Loaded:");
224
+
225
+ VERIFY_ARE_EQUAL(outNm, L" Loaded: masked (Reason: Unit NetworkManager-wait-online.service is masked.)\n");
226
}
227
228
TEST_METHOD(SystemdUser)