Bash or Bourne Again Shell, is still widely used across most of the Linux distributions. But, while running the bash command through an elevated command prompt page, users have noticed an error message” Windows Subsystem for Linux has no installed distributions.“. Sometimes the required service for the Bash isn’t running on your system or the system lacks a Linux distribution.
Fix 1 – Install the distributions
If the bash command can’t find the Linux installations or builds, you can install it from Microsoft Store using an elevated Command Prompt window.
1. At first, press the Windows key and start to write “cmd” in the search box.
2. Then, right-tap the “Command Prompt” that appears in the search results and click “Run as administrator” to open an elevated Command Prompt window.
3. When you have access to the Command Prompt window, type this code in the terminal window and hit Enter to install the Linux distributions manually.
lxrun /install
Command Prompt will now try to install the Linux distribution from Microsoft Store.
4. So, when you are asked, type “Y” to start the downloading process.
Once the Linux installation is installed on your system, close the Command Prompt screen.
After that, try to execute the bash command again.
NOTE 1 –
If you see this error message on your screen –
'lxrun' is not recognized as an internal or external command, operable program or batch file.
1. You can use the “wsl” command to get the list view of available Linux distributions directly. So, execute this code in the CMD terminal,
wsl --list --online
2. Now, if you want to install a particular Linux distribution directly, execute this command –
wsl --install -d nameofthedistro
NOTE –
Replace the “nameofthedistro” with the name of the Linux distribution that you want to install.
Example – Suppose, you are trying to install Ubuntu. So, the code is –
wsl --install -d Ubuntu
If you see the error message again, try installing Linux distributions directly from https://aka.ms/wslstore.
NOTE 2 –
You can also try to run these codes in the PowerShell terminal.
Fix 2 – Set the Ubuntu client as the default
You can set the Ubuntu client as the default. Just follow these steps.
1. At first, right-click the Windows icon on your taskbar and click “Run“.
2. Then, in that Run box, type this and hit the Ctrl+Shift+Esc keys together to open the CMD terminal as an administrator.
cmd
3. Once you reach the CMD terminal as an administrator, copy-paste this code and hit Enter to set the Linux distribution to the default setting on your computer.
wsl --setdefault nameofthedistro
Just replace the “nameofthedistro” with the name of the Linux distribution that you want to set to the default setting.
Example – If you want to set the “Ubuntu 18.04” distribution to the default setting, the code is –
wsl --setdefault Ubuntu-18.04
After executing the code, exit the terminal. This should do the trick. Now, you can use the Bash command again.
Fix 2 – Start the LxssManager service
Try automating the LxssManager Service and starting it up. Check if that helps.
1. At first, press the Windows key+R.
2. Then, write down this in the Run box and hit Enter.
services.msc
3. Now, look for the “LxssManager” service and double-tap the service to edit it.
4. Set the ‘Startup type:’ of the service to “Automatic” from the drop-down list.
5. Then, click “Start” to start the service.
6. After that, click “Apply” and “OK” to save the changes.
Once you have automated this service and started it, close the Services screen. Try executing the Bash command once more.
Fix 3 – Install Ubuntu from Store
If nothing is working, install Ubuntu from Microsoft Store.
1. Open Microsoft Store.
2. Search “Ubuntu” using the search box.
3. You will find several versions of Ubuntu distributions. Find the version you like the most and click “Get“.
Wait for the Store to download and install the latest version of Ubuntu on your computer. Test if this works.
Fix 4 – User change
If you have installed the Linux for a user and trying to use the Bash commands from another, you can see this error message as well.
1. At first, open the Store on your computer.
2. Then, click on your user account and tap “Sign out” to sign out from Store.
You will be signed out of Store.
3. So, tap on the same user account icon and click on “Sign in“.
4. The sign-in page will pop up.
5. Now, this is a very important step. Sign in using the other account.
6. Then, tap on “Continue” to proceed further.
7. Now, once you have signed up, search your preferred Linux distribution and tap “Install“.
Now, you can easily use the bash command to log in again. But, you have to use the account which you have used to install Linux in Store.
Fix 5 – Wait for a while
Some users have also suggested just waiting for a few minutes. Usually, all the necessary processes start in 5 to 10 minutes. So, just sit back and wait for 10-15 minutes, and then try to use the bash command once again.
Fix 6 – Check if have dual-booted the Linux Distribution
There is a common misconception that you can dual boot the Linux and then try to use it using WSL, but it won’t work.
The second OS is installed in the disk partition and you can’t access that Linux while you have booted Windows. If you want to use Linux, just boot out of Windows and boot into Linux. Otherwise, you have to install Linux distributions from Store and use it directly from there.