Trying to use bash on Windows and got no installed distributions message
When the Windows Store opened, there was no Distro to choose, then I found this command lxrun /install
and worked for me as well.
You will get something like this as an output:
C:\WINDOWS\system32>lxrun /install
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
This will install Ubuntu on Windows, distributed by Canonical and licensed under its terms available here:
https://aka.ms/uowterms
Type "y" to continue: y
Downloading from the Microsoft Store... 100%
Extracting filesystem, this will take a few minutes...
Would you like to set the Ubuntu locale to match the Windows locale (en-FI)?
The default locale is en_US.
Type "y" to continue: y
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: <you type your login here>
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
Documentation is available at: https://aka.ms/wsldocs
Windows Subsystem for Linux has no installed distributions even though 'Ubuntu' is installed
Well, I finally found a solution to this problem. /p>
This is as simple as registering the distribution using lxrunoffline
tool using the rg
or register
command.
E:\LxRunOffline\LxRunOffline-v3.3.3>lxrunoffline rg
[ERROR] the option '-d' is required but missing
Options:
-n arg Name of the distribution
-d arg The directory containing the distribution.
-c arg The config file to use. This argument is optional.
After running the register command, I was able to start wsl
as usual. But that would log you in as a "root" user and would thus start in "/root" directory. I ran the following command to start wsl
as different user (this is for Ubuntu):
ubuntu config --default-user <user-name>
WSL issue: Windows Subystem for Linux has no installed distributions
After performing all of the steps above, I noticed that "Ubuntu 18.04 LTS" was in my "Recently Added" programs list in the start menu. Double clicking on it finished the installation.
Windows: How to make cygwin bash.exe to take precedence over wsl in command line?
When you say "command line", I'm going to assume you mean the CMD shell, although you could potentially mean PowerShell.
For CMD, the easiest way to do this is probably with a doskey
alias for bash
:
doskey bash=D:\cygwin\bin\bash.exe $*
To make this permanent, see this answer.
For PowerShell, use the New-Alias
equivalent and set it in your PowerShell profile.
Other options:
Windows Terminal
However, you may want to consider two other tools to make this even (IMHO) easier:
- Windows Terminal
- Microsoft PowerToys with PowerToys Run.
Both of these are Microsoft products and installable from the Microsoft Store.
You can set up a Cygin profile in Windows Terminal named "Bash", and using PowerToys run, activate it via _Bash
. The prefix for any Terminal profile is _
, but you can even skip that if you use it often. Power Run will sort it to the top based on usage.
I recommend turning on the option Open profiles in a new tab in PowerToys Run's "Windows Terminal" settings.
Adjust path
You could adjust your path, but you'll need to do that in the current CMD or PowerShell session, so you'd still need a startup CMD script or PowerShell profile. Given that, I think the Alias approach is probably better.
Running Shell Script via IDE (inteliJ) and receiving: Windows Subsystem for Linux has no installed distributions
To be able to run bash and bash-scripts on a Windows box, Windows Subsystem for Linux needs to be installed. You might want to try installing it. Or, if you transform the bash script into Windows batch script, you can run it by starting cmd
.
Running a sh file in git bash even results in variable assignment statements being shown in terminal
That only happens when both of these occur:
set -x
is usedPS4
is set
If you fix either one, the messages will go away.
If you want to fix number one, you can do set +x
, or you can find the file that
is calling set -x
and remove that line. Probably ~/.bash_profile
or~/.bashrc
.
If you want to fix number two, you can do PS4=
, and you can add it to one of
those files above to persist if you want.
Related Topics
How to Understand "Cmpl $0X0, -0X30(%Rbp)"/"Je ..."
Highlight Text Similar to Grep, But Don't Filter Out Text
Symbolic Link to a Hook in Git
How to Check Syslog in Bash on Linux
Get Current Time in Hours and Minutes
Why Does Perf Stat Show "Stalled-Cycles-Backend" as <Not Supported>
How to Mount an Iso Inside a Docker Container
Linux Directory Permissions for Different Groups
How to Input Password to Git Pull Command
Why Is Cpu-Cycles Much Less Than CPU Current Frequency
How to Force a Cifs Connection to Unmount
How to Edit a Binary File on Unix Systems
How to Hide Wget Output in Linux
Ubuntu: Using Curl to Download an Image
Forcing Driver to Device Match
Setting Up Permissions for Wordpress on Amazon Ec2 (Amazon Linux)
Ps Utility in Linux (Procps), How to Check Which CPU Is Used