Over the past year or so, I have been experiencing extremely slow WSL2 startups, with cold starts taking literal minutes. I discovered that this is because of disconnected network drives which, apparently, take forever to timeout.
I found the following fix, buried within the GitHub Issues for WSL (credits to GitHub user 'oomek'):
-
Open the Registry Editor as an Administrator (search
regedit
in the Start Menu, right click, 'Run as administrator'). -
In the location bar, paste
Computer\HKEY_CURRENT_USER\Network\
and ENTER. -
You should see your network drives listed as registry keys in the left pane (
X
,Y
andZ
) in the screenshot. For each key, do the following:Right click the right pane and select: 'New' > 'DWORD (32-bit) Value'
Name the new DWORD
ProviderFlags
.Double click the
ProviderFlags
DWORD, set its value to 1 and click 'OK'.
If you now boot up the Windows Subsystem for Linux, your boot times should be greatly improved. At least, on my machine, startup time was reduced to a couple of seconds, which I find acceptable.