anthe.sevenants

How to fix WSL2 startup slowdown caused by disconnected network drives

2023-11-23

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'):

  1. Open the Registry Editor as an Administrator (search regedit in the Start Menu, right click, 'Run as administrator').

  2. In the location bar, paste Computer\HKEY_CURRENT_USER\Network\ and ENTER.

  3. You should see your network drives listed as registry keys in the left pane (X, Y and Z) in the screenshot. For each key, do the following:

    Right click the right pane and select: 'New' > 'DWORD (32-bit) Value'

    Windows Registry Editor, overview

    Name the new DWORD ProviderFlags.

    Windows Registry Editor, DWORD renaming

    Double click the ProviderFlags DWORD, set its value to 1 and click 'OK'.

    Windows Registry Editor, DWORD value

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.