WSL icon indicating copy to clipboard operation
WSL copied to clipboard

WSL crashes shortly after starting up

Open J4yTr1n1ty opened this issue 1 year ago • 12 comments

Windows Version

Microsoft Windows [Version 10.0.19045.5131]

WSL Version

2.4.4.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.167.4-1

Distro Version

Arch Linux (https://apps.microsoft.com/detail/9mznmnksm73x)

Other Software

No response

Repro Steps

  1. Start WSL from the Terminal
  2. Wait for some time

Expected Behavior

The WSL will continue to run until the specified idle time.

Actual Behavior

WSL crashes shortly after starting up. Only the message [exited] is shown.

Diagnostic Logs

Log to start WSL in the terminal with it crashing shortly after: WslLogs-2024-11-21_12-34-56.zip

J4yTr1n1ty avatar Nov 21 '24 11:11 J4yTr1n1ty

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Diagnostic information
Multiple log files found, using: https://github.com/user-attachments/files/17845005/WslLogs-2024-11-21_12-34-56.zip
.wslconfig found
Detected appx version: 2.4.4.0

github-actions[bot] avatar Nov 21 '24 11:11 github-actions[bot]

After a long time trying out different things, I have "fixed" part of the problem using the following steps:

  1. Export the WSL Instance
  2. Unregister the WSL Instance
  3. Import the WSL Instance
  4. Run into WSL as root
  5. su to my user

If the default user is set to the personal user, it will still crash

This inhibits the crash. However, GUI applications still do not work.

J4yTr1n1ty avatar Nov 24 '24 20:11 J4yTr1n1ty

I have the same problem. It seems comes up whenever I use "too many resource" (like opening a large file from linux), despite randomly trying fixes from Google (increasing the limit in WSL config, raising priority of process, restarting wsl, etc). Rebooting the computer lets wsl work until it stops working again.

sboosali avatar Nov 25 '24 19:11 sboosali

@J4yTr1n1ty: What kind of command line do you see "crashing" ? I do see that a process is exiting with error code = 1, but from what I see it's unclear whether this issue is coming from WSL itself, or from that process. The Virtual machine is still running at the end of the first trace you sent.

OneBlue avatar Nov 26 '24 23:11 OneBlue

Hey @OneBlue, what happened for me is that I opened up the WSL from powershell using the wsl command, and it showed [exited] after a short while. Since I have not changed anything on my I first assumed it to be a WSL issue. However, it could be very well possible that it's the distribution or a process starting up in the distribution. Is there an easy way to trace this?

J4yTr1n1ty avatar Nov 27 '24 12:11 J4yTr1n1ty

An interesting thing I found is that if I remove the default user from the WSL configuration, I can access the virtual machine as root and change my user after the shell is initialized. This completely removes the "crashing" state.

J4yTr1n1ty avatar Nov 27 '24 12:11 J4yTr1n1ty

I have the same problem, we have windows imposed as os on our computer at work so I do almost everything in an Arch WSL2, my WSL often close right after opening, I often have to open it again multiple times until one of them stay open which usually takes me a good 10-30 minutes of work time out of my day >:( This behavior doesn't seem to be linked to what I'm doing or what my computer is doing

distro: Arch Linux

Rignchen avatar Jan 31 '25 08:01 Rignchen

Hey, I still have this issue, I changed disto since, I now use the NixOs wsl WSL version 2.4.13.0 I've record this happening Image I do not touch my mouse and keyboard during this recording (except for writing "wsl") but this also happends sometimes when I'm doing stuff can be a problem This happens similarly when I open the wsl without using the powershell command

Rignchen avatar May 27 '25 06:05 Rignchen

Interesting. Do you use screen, or tmux ? The "no sessions" messages makes me think that something like that is causing this

OneBlue avatar May 29 '25 23:05 OneBlue

I can add to the original that I was using tmux, which was initialized in my zshrc. I'm no longer on WSL, so I can't speak to newer updates. But for me, it would also launch a shell and then crash after a couple seconds.

J4yTr1n1ty avatar May 30 '25 13:05 J4yTr1n1ty

Interesting. Do you see the same behavior if you run let's say wsl bash ?

OneBlue avatar May 30 '25 18:05 OneBlue

I tried reproducing my environment as close as possible in a VM, however did not encounter the crash. @Rignchen might be able to try this.

J4yTr1n1ty avatar May 31 '25 16:05 J4yTr1n1ty

I actually have this same issue. I am using Artix Linux with Tmux, and like others, after running wsl from the terminal or cmd, after a short period it crashes as 'exited'. Mostly this seems to only show up for me on first run after wsl loads.

anthonymesa avatar Aug 19 '25 14:08 anthonymesa

This issue is actually reproducible and still happens as of now. I use fish shell with tmux and adding this code to the config.fish file, I can consistently reproduce this issue. This happens because of starting tmux using exec command. Also, this happens to me when I freshly start windows and start wsl the first two times and from the third time it does not happen anymore. For anyone facing the same issue, I would suggest you to stop using exec to start tmux, and it should be fixed.

if status is-interactive
    and not set -q TMUX
    # Dont use `exec` to start tmux as it causes wsl to quit
    exec tmux -2u
end

231tr0n avatar Oct 17 '25 09:10 231tr0n

yeah the issue definitely is the exec tmux command as @231tr0n pointed out, because after removing that line from my zshrc file, WSL dosen't exit abruptly. What I did notice however, was that if I run my terminal emulator (Alacritty) as an administrator, nothing crashes. Could be something to do with permissions or zsh specifically.

HamammSoleman avatar Dec 07 '25 23:12 HamammSoleman