WSL 2: Error 0x80070040 The specified network name is no longer available (And How to Fix It)
In this tutorial, we are going to learn how to solve
Error: 0x80070040 The specified network name is no longer available in Windows 10 WSL 2.
This is a very well-known error that happens in Windows Subsystem for Linux 2 when installing a new Linux distribution.
Installing, this may take a few minutes... WslRegisterDistribution failed with error: 0x80070040 Error: 0x80070040 The specified network name is no longer available. Press any key to continue...
There is an easy workaround for this error. What we need to do is set WSL 1 as the default WSL version and let our new distro install in WSL 1. After it was successfully installed, we can convert it to a WSL 2 distro.
For example, in my Windows 10 PC, I have a Kali Linux distribution that fails to install with the error:
The specified network name is no longer available.
To solve this problem, first, we need to set WSL 1 as the default WSL version by running the following command:
wsl --set-default-version 1
Next, we will start the distro (It should start without any problem in WSL 1).
After that, exit the distro and convert it to WSL 2 using the following command:
wsl --set-version kali-linux 2
After the process completes in a few minutes, we should be able to start our Linux distribution without an error, running on Windows Subsystem for Linux 2.
We can run the
wsl --list -v command to verify that the distro was converted to WSL 2.