I suspect this has to do with a new windows insider update, but I am pretty lost.
Things I have tried
- Unchecking Hyper-V, containers, and Windows subsytem for Linux in "Windows Features"
- Running docker as administrator
- Downgrading WSL to version 1
- Uninstalling and reinstalling Docker
- Update and upgrade Ubuntu
Here is the log:
System.InvalidOperationException:
Failed to deploy distro docker-desktop to C:\Users\mburk\AppData\Local\Docker\wsl\distro: exit code: -1
stdout: The parameter is incorrect.
stderr:
at Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:line 146
at Docker.Engines.WSL2.WSL2Provisioning.<DeployDistroAsync>d__17.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:line 169
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:line 78
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__26.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:line 104
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:line 29
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 92
Tried to put as much info down for y'all as I could, just comment and let me know if you need more.
background
I had a similar issue after changing the IP of a Nat network, which I'm using for one of my HyperV VMs. Once the change was done, my Default Network for HyperV disappeared and I could also no longer works with Ubuntu in WSL2. To fix it, I tried many suggestions a simple networking reset + reboot after completely removing HyperV, Virtual Machine Platform and Windows Subsystem for Linux + reinstalling them after another reboot once the network reset was done. The error message however stayed. I also tried just creating a Nat Switch called WSL or an external Switch using my WiFi network, but that didn't help either. I even tried upgrading to Window11 via the upgrade assistant, hoping the new OS would come with a fully working network setup, but that was also useless.
In the end I saw en error in the event log pointing to the NetNat service not being able to start. This then lead me to a SO article pointing to a potential registry issue with the settings under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nsi\
Solution
Therefore, I tried resetting my network more thoroughly as suggested by one or more network protocols are missing and did a complete reset using the commands as admin
For some netsh commands I got
Access is denied.Resetting , OK!
errors.I fixed those by granting access permissions in Regedit to all sub-keys e.g.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nsi\{eb004a00-9b1a-11d4-9123-0050047759bc}\26
for Everyone (Full Access) which was mentioned and described in more detail in the article.WARNING: Backup your full key
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nsi\
first by doing an export to a file via Regedit to be extra safe !Once the permissions were set, the netsh commands above worked without complaining about access.
Then I removed HyperV, Virtual Machine Platform and Windows Subsystem for Linux again rebooted and just installed HyperV after another reboot. To my joy, the previously missing Default Network adapter reappeared after that step.
Next I reinstalled Virtual Machine Platform and Windows Subsystem for Linux again and also deleted the old package information for the canonical package (as I was using Ubuntu) under
%localappdata%\Packages
(you need to take ownership first via right click Properties-> Security -> Advanced -> Owner (either administrators or your user is fine) and then grant yourself or administrators Full Control in Explorer).After that I reinstalled the package via the store and WSL2 worked again for me.