mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-11 04:35:57 -06:00
Mask systemd-networkd-wait-online.service during boot (#13611)
This commit is contained in:
parent
dbf49f1ae9
commit
f75997128d
@ -329,6 +329,10 @@ int GenerateSystemdUnits(int Argc, char** Argv)
|
||||
File.reset();
|
||||
}
|
||||
|
||||
// Mask systemd-networkd-wait-online.service since WSL always ensures that networking is configured during boot.
|
||||
// That unit can cause systemd boot timeouts since WSL's network interface is unmanaged by systemd.
|
||||
THROW_LAST_ERROR_IF(symlink("/dev/null", std::format("{}/systemd-networkd-wait-online.service", installPath).c_str()) < 0);
|
||||
|
||||
// Only create the wslg unit if both enabled in wsl.conf, and if the wslg folder actually exists.
|
||||
if (enableGuiApps && access("/mnt/wslg/runtime-dir", F_OK) == 0)
|
||||
{
|
||||
|
||||
@ -211,6 +211,12 @@ class UnitTests
|
||||
|
||||
auto revert = EnableSystemd();
|
||||
VERIFY_IS_TRUE(IsSystemdRunning(L"--system"));
|
||||
|
||||
// Validate that systemd-networkd-wait-online.service is masked.
|
||||
auto [out, _] =
|
||||
LxsstuLaunchWslAndCaptureOutput(L"systemctl status systemd-networkd-wait-online.service | grep -iF Loaded:");
|
||||
|
||||
VERIFY_ARE_EQUAL(out, L" Loaded: masked (Reason: Unit systemd-networkd-wait-online.service is masked.)\n");
|
||||
}
|
||||
|
||||
TEST_METHOD(SystemdUser)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user