File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,10 @@ int GenerateSystemdUnits(int Argc, char** Argv)
329329 File.reset ();
330330 }
331331
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+
332336 // Only create the wslg unit if both enabled in wsl.conf, and if the wslg folder actually exists.
333337 if (enableGuiApps && access (" /mnt/wslg/runtime-dir" , F_OK) == 0 )
334338 {
Original file line number Diff line number Diff line change @@ -211,6 +211,12 @@ class UnitTests
211211
212212 auto revert = EnableSystemd ();
213213 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 " );
214220 }
215221
216222 TEST_METHOD (SystemdUser)
You can’t perform that action at this time.
0 commit comments