Docker desktop Unexpected WSL error Win11

Hi,

I have a Windows 11 laptop that is configured with about 2TB disk space and 32GB of ram i5 CPU works quite well with everything and its a company issue laptop so on an AD domain but I have local admin rights.

I had been using WSL for some time for development work and my typical setup was Ubuntu WSL2 image configured for Ruby on Rails development duties and had some containers that I spun up from the bash console consisting of Redis, postgresql database, opensearch and antivirus.

Docker Desktop was configured to use Ubuntu as the WSL2 backend distro and I could see the containers in the Desktop app all good so far.

For some reason last week postgresql stopped accepting connection requests from within the Ubuntu environment using PSQL command or Rails same issue unable to connect with user postgres on port 5432. I was however able to terminal into the postgresql container from the Docker Desktop app and I could talk to it just fine using PSQL after authenticating using the postgres user.

I tried other ditsros had slightly more success with Kali Linux only after a reboot I would then lose the ability to either spin up the container (port clashing?!) so after changing the port to 5431, then starting the container then shutting it down, reverting the port back to the default the containers spin up fine (just a bog standard docker-compose.yml file being used here nothing special persisted volume that’s it as per the postgres docker documentation).

I decided to uninstall docker desktop, then WSL as well after unregistering the distros I had and starting over again got through the installs did the usual many reboots, WSL looks fine I can log into the Ubuntu WSL2 distro (I obtained this from Microsoft Store not the online WSL repo…) all good however…

When I start Docker Desktop I get a nasty error:

deploying WSL2 distributions
ensuring main distro is deployed: checking if main distro is up to date: checking main distro bootstrap version: getting main distro bootstrap version: exit code: 4294967295: running WSL command wsl.exe C:\Windows\System32\wsl.exe -d docker-desktop -u root -e wsl-bootstrap version: Failed to attach disk '<HOME>\AppData\Local\Docker\wsl\main\ext4.vhdx' to WSL2: The system cannot find the path specified. 
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_PATH_NOT_FOUND
: exit status 0xffffffff
checking if isocache exists: CreateFile \\wsl$\docker-desktop-data\isocache\: The network name cannot be found.

I navigated to that appData folder and the wsl folder doesn’t exist for starters so no wonder it can’t find the disk image but I can’t seem to get out of this issue now stuck in a loop unable to use Docker Desktop (and docker for that matter) its caused major issues for me. I have tried pretty much everything short of reinstalling Windows 11 but it seems like this is my only option now?

Diagnostics check output:

C:\Program Files\Docker\Docker\resources> .\com.docker.diagnose.exe check
Starting diagnostics

[2024-07-04T17:34:40.528491900Z][com.docker.diagnose.exe.ipc] 8a2e95bc-diagnose -> \\.\pipe\dockerBackendApiServer BackendAPI
[2024-07-04T17:34:40.631094700Z][com.docker.diagnose.exe.ipc] (1267db90) 8a2e95bc-diagnose C->S BackendAPI POST /idle/make-busy
[2024-07-04T17:34:40.634935400Z][com.docker.diagnose.exe.ipc] (1267db90) 8a2e95bc-diagnose C<-S 0baf413c-BackendAPI POST /idle/make-busy (3.8363ms): 0xc00048bfe0
[2024-07-04T17:34:41.636650800Z][com.docker.diagnose.exe.ipc] (04fbd5df) 8a2e95bc-diagnose C->S BackendAPI GET /idle
[2024-07-04T17:34:41.639510700Z][com.docker.diagnose.exe.ipc] (04fbd5df) 8a2e95bc-diagnose C<-S 0baf413c-BackendAPI GET /idle (2.8567ms): {"apisInFlight":{"/_ping":3},"booted":false,"busyReason":["in-flight APIs: map[/_ping:3]","timed activities: map[/idle/make-busy:28.9972338s]"],"containers":0,"idle":"bool","kubernetesEnabled":false,"reduced":false,"services":0,"timedActivities":{"/idle/make-busy":"float64"},"vmPaused":false,"vmRunning":true,"vmStopped":false,"windowsContainers":false}
[PASS] DD0027: is there available disk space on the host?
[SKIP] DD0028: is there available VM disk space?
[SKIP] DD0002: does the bootloader have virtualization enabled?
[SKIP] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[SKIP] DD0022: is the Virtual Machine Platform Windows Feature enabled?
[SKIP] DD0021: is the WSL 2 Windows Feature enabled?
[PASS] DD0024: is WSL installed?
[PASS] DD0025: are WSL distros installed?
[PASS] DD0026: is the WSL LxssManager service running?
[FAIL] DD0029: is the WSL 2 Linux filesystem corrupt? exit status 0xffffffff
[FAIL] DD0035: is the VM time synchronized? exit status 0xffffffff
[FAIL] DD0017: can a VM be started? prereq failed: is the WSL 2 Linux filesystem corrupt?
[FAIL] DD0016: is the LinuxKit VM running? prereq failed: can a VM be started?
[FAIL] DD0004: is the Docker engine running? prereq failed: is the LinuxKit VM running?
[PASS] DD0015: are the binary symlinks installed?
[FAIL] DD0031: does the Docker API work? prereq failed: is the Docker engine running?
[PASS] DD0013: is the $PATH ok?
[FAIL] DD0003: is the Docker CLI working? prereq failed: is the Docker engine running?
[FAIL] DD0005: is the user in the docker-users group? prereq failed: is the LinuxKit VM running?
[FAIL] DD0038: is the connection to Docker working? prereq failed: is the Docker engine running?
[FAIL] DD0014: are the backend processes running? prereq failed: is the LinuxKit VM running?
[FAIL] DD0007: is the backend responding? prereq failed: are the backend processes running?
[FAIL] DD0009: is the vpnkit API responding? prereq failed: are the backend processes running?
[FAIL] DD0010: is the Docker API proxy responding? prereq failed: are the backend processes running?
[SKIP] DD0006: is the Docker Desktop Service responding?
[FAIL] DD0030: is the image access management authorized? prereq failed: is the Docker engine running?
[PASS] DD0033: does the host have Internet access?
[PASS] DD0002: does the bootloader have virtualization enabled?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0022: is the Virtual Machine Platform Windows Feature enabled?
[PASS] DD0021: is the WSL 2 Windows Feature enabled?
[PASS] DD0024: is WSL installed?
[PASS] DD0025: are WSL distros installed?
[PASS] DD0026: is the WSL LxssManager service running?
[WARN] DD0029: is the WSL 2 Linux filesystem corrupt? exit status 0xffffffff
[WARN] DD0035: is the VM time synchronized? exit status 0xffffffff
[WARN] DD0017: can a VM be started? prereq failed: is the WSL 2 Linux filesystem corrupt?
[WARN] DD0016: is the LinuxKit VM running? prereq failed: can a VM be started?
[WARN] DD0004: is the Docker engine running? prereq failed: is the LinuxKit VM running?
[PASS] DD0015: are the binary symlinks installed?
[WARN] DD0031: does the Docker API work? prereq failed: is the Docker engine running?
[WARN] DD0032: do Docker networks overlap with host IPs? prereq failed: does the Docker API work?

Please note the following 7 warnings:

1 : The check: is the WSL 2 Linux filesystem corrupt?
    Produced the following warning: exit status 0xffffffff

If the WSL 2 Linux filesystem is corrupt then Docker Desktop cannot start.
There is a known issue fixed in Windows Insider builds which can cause filesystem corruption, see:
https://github.com/microsoft/WSL/issues/5895 .

Try running "wsl --shutdown" to stop your WSL Virtual Machine. When it restarts it will
run a filesystem check and hopefully fix the problem.


2 : The check: is the VM time synchronized?
    Produced the following warning: exit status 0xffffffff

The VM time must be in sync with the host, otherwise Docker Desktop will not work correctly.

Ensure you are using a modern WSL 2 kernel (see "wsl --update"). If this problem persists,
try manually synchronizing the VM clock with "sudo hwclock -s".

3 : The check: can a VM be started?
    Produced the following warning: prereq failed: is the WSL 2 Linux filesystem corrupt?

The Docker engine runs inside a Linux VM. Therefore we must be able to start Virtual Machines.

4 : The check: is the LinuxKit VM running?
    Produced the following warning: prereq failed: can a VM be started?

The Docker engine runs inside a Linux VM. Therefore the VM must be running.

5 : The check: is the Docker engine running?
    Produced the following warning: prereq failed: is the LinuxKit VM running?

The Docker engine manages all containers and images on the host. Check the dockerd.log to see why it failed to start.

6 : The check: does the Docker API work?
    Produced the following warning: prereq failed: is the Docker engine running?

If the Docker API is not available from the host then Docker Desktop will not work correctly.

7 : The check: do Docker networks overlap with host IPs?
    Produced the following warning: prereq failed: does the Docker API work?

If the subnet used by a Docker network overlaps with an IP used by the host, then containers
won't be able to contact the overlapping IP addresses.

Try configuring the IP address range used by networks: in your docker-compose.yml.
See https://docs.docker.com/compose/compose-file/compose-file-v2/#ipv4_address-ipv6_address


Please investigate the following 2 issues:

1 : The test: is the WSL 2 Linux filesystem corrupt?
    Failed with: exit status 0xffffffff

If the WSL 2 Linux filesystem is corrupt then Docker Desktop cannot start.
There is a known issue fixed in Windows Insider builds which can cause filesystem corruption, see:
https://github.com/microsoft/WSL/issues/5895 .

Try running "wsl --shutdown" to stop your WSL Virtual Machine. When it restarts it will
run a filesystem check and hopefully fix the problem.


2 : The test: is the VM time synchronized?
    Failed with: exit status 0xffffffff

The VM time must be in sync with the host, otherwise Docker Desktop will not work correctly.

Ensure you are using a modern WSL 2 kernel (see "wsl --update"). If this problem persists,
try manually synchronizing the VM clock with "sudo hwclock -s".

Any ideas why this happened and how I can recover please?

Thank you in advance.

T