Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL closes immediately #6218

Closed
jmoteka opened this issue Nov 9, 2020 · 20 comments
Closed

WSL closes immediately #6218

jmoteka opened this issue Nov 9, 2020 · 20 comments

Comments

@jmoteka
Copy link

jmoteka commented Nov 9, 2020

Environment

Windows build number: Microsoft Windows [Version 10.0.18363.1139]
Your Distribution version: Ubuntu 20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL 2 (Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020)

Steps to reproduce

Running: "Open Linux shell here" from context menu, run "wsl" from cmd or PowerShell.

Expected behavior

Shell opens. Shell opens at the location I selected "Open Linux shell here".

Actual behavior

This results in a window which closes immediately. No possibility of interacting or even taking a look a the error message.
If running in the command line this is followed by no response.

wsl only works if distro is mentioned explicitely: wsl -d ubuntu

@ghost
Copy link

ghost commented Nov 10, 2020

Which is your default distro?

@therealkenc
Copy link
Collaborator

Which is your default distro?

Or better, output of wsl.exe -l -v.

@ghost
Copy link

ghost commented Nov 11, 2020

@therealkenc You are thinking what I am thinking.

@mathball31
Copy link

mathball31 commented Nov 12, 2020

EDIT: I'm afraid I actually have a different issue. wsl from powershell works fine for me. My issue is with mintty.

Original:

I have the same issue.

wsl.exe -l -v
  NAME      STATE           VERSION
* Legacy    Running         1

@ghost
Copy link

ghost commented Nov 12, 2020

What is Legacy?

@therealkenc
Copy link
Collaborator

therealkenc commented Nov 12, 2020

* Legacy Running 1

Well that's interesting, insofar as wsl.exe -d ubuntu launches successfully, but Ubuntu is not in your list. Which is at least a little like #6024.

You might try:

C:\> wsl.exe --set-default Ubuntu

Assuming that takes, Ubuntu will be your default. You won't need the -d parameter to wsl.exe, and with fingers crossed, it might launch from the context menu as well.

Before doing so, out of an abundance of caution, you might want to backup your Ubuntu distribution with wsl.exe --export Ubuntu <filename> (if you have any valuable data in there). You can also try installing another distribution with a different name (say Ubuntu-20.04) to see if it shows up in the wsl -l -v list. Then set Ubuntu-20.04 as the default.

No possibility of interacting or even taking a look a the error message.

Trying running wsl.exe -d Legacy from a command prompt. Presumably the Legacy distro will fail to launch.

If it fails to launch, and you like, collect WSL logs and post the backlink to the feedback item here. Although in the circumstance, you are probably shooting for WSL2 Ubuntu anyway.

What is Legacy?

It is the distribution that used to ship with the now-deprecated bash.exe. Ref some commentary in #4717, including --export and --import.

@ghost
Copy link

ghost commented Nov 12, 2020

Same thing happens when your default distro is docker-desktop or docker-desktop-data.

@ktre2017
Copy link

Hi, I have the same issue

WSL is closing immediately

wsl.exe -l -v
NAME STATE VERSION

  • Ubuntu-18.04 Stopped 1

Please advise how to fix this

@ghost
Copy link

ghost commented Nov 12, 2020

@ktre2017 Does running wsl -d Ubuntu-18.04 work?

@ktre2017
Copy link

@ktre2017 Does running wsl -d Ubuntu-18.04 work?

I tried but it didn't work.

@ghost
Copy link

ghost commented Nov 12, 2020

Then something is wrong with Ubuntu 18.04 distro. /cc @craigloewen-msft

@jmoteka
Copy link
Author

jmoteka commented Nov 13, 2020

@therealkenc thanks! basically the default distro was docker

@Elia-238
Copy link

The same thing happened to me.
I was able to find the problem after running as root:

 wsl -d Ubuntu-22.04 --user root

Then I did:

su my_username

And I saw that there was a problem with my shell prompt.
I fixed it, and then everything went back to normal.

@jasojone
Copy link

jasojone commented Sep 2, 2022

image
Not sure if any can help me with my issue. So I just got a refurb replacement note 8, and the WSL is not opening. I can't even install Ubuntu, I get this error for that,
image

@anayarojo
Copy link

In my case, I didn't have Ubuntu distribution.

So, I installed it, using this command:

wsl --install -d Ubuntu

Then I used the following command to set the Ubuntu distribution as default:

wsl --set-default Ubuntu

Other useful commands:

# To list all installed distributions
wsl --list --verbose
wsl -l -v

# To see the available distributions to install
wls --list --online

@majid-2002
Copy link

majid-2002 commented May 6, 2023

I can't install ubuntu distro using my wsl and open it . I tried to install the Ubuntu using this command

wsl --install -d Ubuntu

And then the Ubuntu shell opens and then it asks to press a key to continue but when I press the key the window immediately closes. And when I try to open again it shows you have no distros installed.

Windows Subsystem for Linux has no installed distributions.                                                            
Distributions can be installed by visiting the Microsoft Store:                                                        
https://aka.ms/wslstore              

I tried listing the distros using this command

wsl --list --verbose

but it shows no distros installed.

@majid-2002
Copy link

majid-2002 commented May 6, 2023

I can't install ubuntu distro using my wsl and open it . I tried to install the Ubuntu using this command

wsl --install -d Ubuntu

And then the Ubuntu shell opens and then it asks to press a key to continue but when I press the key the window immediately closes. And when I try to open again it shows you have no distros installed.

Windows Subsystem for Linux has no installed distributions.                                                            
Distributions can be installed by visiting the Microsoft Store:                                                        
https://aka.ms/wslstore              

I tried listing the distros using this command

wsl --list --verbose

but it shows no distros installed.

Finally solved this issue by doing a kernel update from the wsl docs

Kernel update for x64

@DeleMike
Copy link

@therealkenc Thank you!

@rin67630
Copy link

rin67630 commented Oct 20, 2023

Same same here.
Win 10 Version 10.0.22621.2428, just updated.
Freshly installed WSL Debian from the store.
wsl-exe -l -v
issues
* Debian Stopped 1

wsl -d debian
issues
Fehler beim bereit stellen eines Ihrer Datei Systeme. Führen Sie "dmesg" aus, um weitere Details anzuzeigen.
which translates to
Error mounting one of your file systems. Run dmesg to see more details.

All partitions are clean, The usual 3 windows Partition, one ExFat, the last one is Ext4

There is no command dmesg accepted.

@ThomasSpare
Copy link

ThomasSpare commented May 10, 2024

Had this problem to. Probably because some change to WSL as default.
Solution: If you already have Ubuntu installed
RUN THIS IN POWERSHELL
wsl --set-default Ubuntu

But after this when I run wsl I get stuck in some root position, something I haven´t seen before when it was working.
root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests