Getting error 2147942402 (0x80070002) while launching recently downloaded WSL (Ubuntu 22.04). I recently downloaded the lasted Ubuntu WSL from the Microsoft store and, when I am trying to open the terminal, it shows an error code.
However, I have found the solution to fix the error of this problem. Perhaps this error is caused because you have already installed an Ubuntu WSL of a different version or incorrectly configured the command line for a particular WSL.
So, to fix this error you must follow the steps, which I have explained in this article:
Step: 1. Open Windows Terminal Setting
First of all, you will need to be installed a WSL distribution (In this tutorial we have used Ubuntu 22.04 LTS). As you have seen the error image while opening the in the Windows Terminal. So, open the Windows Terminal settings as shown in the image above. Now follow the next step.
Step: 2. Select WSL, which shows the error
Select the WSL which is showing an error from the sidebar as shown in the image above. When you click on the WSL, you will see the command line location for the distributions. The location will be incorrectly configured, and you must set the complete WSL location to work properly.
Step: 3. Change Proper WSL Location to Access in Terminal
Now, click on the command line section to correct the WSL’s proper location, as you can see in the image above. You must add the full executable location. In case you are getting errors for a different version of Ubuntu distro or Debian, you can just take the example location as mentioned below.
C:\Windows\system32\wsl.exe -d Ubuntu-22.04
In case you have Ubuntu 20.04, Ubuntu 18.04 or Debian then you have to replace it with a proper distribution name.
After all, when you define the correct location and save, and open the terminal with your WSL distro, no error shows again. Now you can use the terminal for your Linux system normally and without any errors.
So, this tutorial ends here, but if you get any error regarding WSL or Linux terminal you can ask in the comment box.