WSL crashes shortly after starting up
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
- Start WSL from the Terminal
- 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
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:
- WSL crashes/shuts down periodically (#12089), similarity score: 0.79
- WSL sometimes crashes when computer wakes from sleep (#9563), similarity score: 0.76
Closed similar issues:
- WSL crashes and can't be restarted (#9767), similarity score: 0.78
- WSL crashes when building application (#12238), similarity score: 0.76
- WSL2 crashes at startup (#4768), similarity score: 0.75
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
After a long time trying out different things, I have "fixed" part of the problem using the following steps:
- Export the WSL Instance
- Unregister the WSL Instance
- Import the WSL Instance
- Run into WSL as root
- 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.
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.
@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.
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?
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.
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
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
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
Interesting. Do you use screen, or tmux ? The "no sessions" messages makes me think that something like that is causing this
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.
Interesting. Do you see the same behavior if you run let's say wsl bash ?
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.
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.
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
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.