Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash on Ubuntu on Windows not starting

So, I've been using the new(ish) Bash on Ubuntu on Windows (WSL) for a while now and all has been top-notch, until yesterday.

I git-pushed from Bash by accident, so it asked me for my repo-destination account details like normal. I decided to ignore this, terminate Bash and try to just use powershell instead (can't ever remember passwords!). Terminating Bash however caused the shell to freeze. I forced closed and restarted my comp (I've had to force close and restart several times before for various reasons and everything was fine).

After boot up, I just tried to check if Bash was working again, but it wasn't. It just failed to start with no error message. For example:

PS C:\WINDOWS\system32> bash
PS C:\WINDOWS\system32>

Has anyone else had a similar situation/knows how to help?

EDIT: Only solved through reinstalling bash, using

    lxrun /uninstall /full

then

    lxrun /install 
like image 451
oblong Avatar asked May 18 '17 13:05

oblong


People also ask

Why is Bash not opening Windows?

Procedure One. It is required to follow a step-by-step process to enable Bash in Windows 10, so, in the first step, enable the Windows Subsystem for Linux. Search the term “feature” in the Start Menu search bar and select “Turn Windows feature on and off” from the results list.

How do I start the Bash terminal in Windows?

Press Windows key + X then click Command prompt, at the command prompt, type: bash then hit Enter. If you want to be able to access the local file system, press Windows key + X, Command Prompt (Admin) then type bash at the prompt.

Why is my WSL not opening?

Ensure that you have the Windows Subsystem for Linux enabled, and that you're using Windows Build version 18362 or later. To enable WSL run this command in a PowerShell prompt with admin privileges: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux .

Can Bash work on Windows?

Note that bash runs natively on Windows 10, which is different from using emulators like 'cygwin' for Windows which enabled GNU tools to run on unsupported Windows environment. Also, Linux subsystem for Windows 10 is only available on the 64-bit version of the OS.


3 Answers

I had the same issue but my solution was different. I found that my (Default) WSL distribution was set to docker-desktop-data instead of my Ubuntu distribution, e.g.

In PowerShell (Windows Shell): wslconfig /L

This lists WSL distributions. For me "docker-desktop-data (Default)" was listed as default not my Ubuntu distribution.

To change this:

In PowerShell (Windows Shell): wslconfig /setdefault Ubuntu-20.04

like image 74
Mark Avatar answered Sep 21 '22 13:09

Mark


Came here with a similar issue, but a different solution, so I'll post in case it helps anyone else.

The difference in my situation was that, when running bash through Command Prompt, it complained about Legacy Mode being enabled.

  1. Open a regular command prompt (win+r then cmd)
  2. Right-click the title bar and select Properties
  3. Deselect "Use legacy console (requires restart)"

Now it should work either by launching the standalone app, or typing bash into a regular cmd window after restarting Command Prompt.

This and other causes can be found in this Github issue.

like image 32
Dave S Avatar answered Sep 22 '22 13:09

Dave S


The solutions listed also did not work for me. I found a solution here.

Essentially, navigate to Control Panel > System > Advanced System Settings > Advanced > Settings > Advanced > Virtual memory, Change ..., and set a Custom size for the paging file size: 800 min and 1024 max. Restarted, and the command prompt came back.

like image 32
Robert Yi Avatar answered Sep 24 '22 13:09

Robert Yi