Are you facing issues with WSL (Windows Subsystem for Linux) after moving your Ubuntu installation from drive C to drive D? Don't worry, we've got you covered. In this article, we will walk you through the steps to fix WSL not working after moving Ubuntu from C to D.
Step 1: Uninstall Ubuntu from WSL
The first step is to uninstall the existing Ubuntu installation from WSL. To do this, follow these steps:
- Open the Command Prompt by pressing
Win + R, typingcmd, and hitting Enter. - Run the following command to list the installed distributions:
wsl --list --verbose
Take note of the name of the distribution you want to uninstall (e.g., "Ubuntu-20.04").
- Run the following command to uninstall the distribution:
wsl --unregister <DistributionName>
Replace <DistributionName> with the actual name of the distribution you want to uninstall. For example, if your distribution is "Ubuntu-20.04", the command would be:
wsl --unregister Ubuntu-20.04
Step 2: Move the Ubuntu Installation
Now that we have uninstalled the existing Ubuntu installation, we can proceed with moving it to the new location on drive D. Follow these steps:
- Create a folder on drive D where you want to move the Ubuntu installation. For example, you can create a folder named "Ubuntu" at the root of drive D.
- Download the latest Ubuntu distribution from the Microsoft Store. Search for "Ubuntu" in the Microsoft Store and click on the "Ubuntu" app to download and install it.
- Launch the newly installed Ubuntu app from the Start menu.
- During the initial setup, you will be prompted to create a new user and set a password. Follow the instructions to complete the setup.
Step 3: Update WSL Configuration
Now that we have moved the Ubuntu installation to drive D, we need to update the WSL configuration to point to the new location. Follow these steps:
- Open the Command Prompt as an administrator.
- Run the following command to list the installed distributions:
wsl --list --verbose
Verify that the new Ubuntu installation on drive D is listed.
- Run the following command to set the default WSL version to 2:
wsl --set-default-version 2
- Run the following command to update the distribution to use WSL version 2:
wsl --set-version <DistributionName> 2
Replace <DistributionName> with the actual name of the distribution you want to update. For example, if your distribution is "Ubuntu-20.04", the command would be:
wsl --set-version Ubuntu-20.04 2
Step 4: Launch WSL
Now that we have updated the WSL configuration, we can launch the Ubuntu installation on drive D. Follow these steps:
- Open the Command Prompt.
- Run the following command to launch the Ubuntu installation:
wsl --distribution <DistributionName>
Replace <DistributionName> with the actual name of the distribution you want to launch. For example, if your distribution is "Ubuntu-20.04", the command would be:
wsl --distribution Ubuntu-20.04
After running this command, the Ubuntu terminal will open, and you can start using WSL on drive D.
Congratulations! You have successfully fixed WSL not working after moving Ubuntu from C to D. You can now enjoy using WSL on your new drive location.
| No. | Source |
|---|---|
| 1 | Microsoft Store |