Docker WSL 2 error 0xffffffff

The problem doesn't happen everytime, but when it does, launching a WSL bash prompt shows a 0xffffffff error:

WSL bash prompt with error 0xffffffff
WSL bash prompt with error 0xffffffff

Docker for Windows create a crash report dialog.

Docker for Windows with error 0xffffffff
Docker for Windows with error 0xffffffff

There's an open issue in the github WSL repo so hopefully it'll be solved soon. In the mean time, both of them seem to be related to port 53 being used by another program. PowerShell to the rescue:

Get-Process -Id (Get-NetUDPEndpoint -LocalPort 53).OwningProcess

C:\> Get-Process -Id (Get-NetUDPEndpoint -LocalPort 53).OwningProces

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id     SI ProcessName
-------  ------    -----      -----     ------     --     -- -----------
      0       0       60          8                 7463   0 docker
      0       0       60          8                 8463   0 svchost

In my case I got two hits, so take a note of the Id and terminate both processes with:

Stop-Process -Id <ID>

Once I had to add an --force onto the end of that command to make sure.

After that, I was now to restart Docker and WSL without any problems until the next reboot.

Posted on in Docker