WSL: WSL2 - "The Windows Subsystem for Linux instance has terminated."

  • Your Windows build number: (Type ver at a Windows Command Prompt) Microsoft Windows [Version 10.0.19041.207]

  • What you’re doing and what’s happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.) I moved/exported/Imported my WSL2 Debian Distro from an old Computer (AMD A10) to a newer AMD FX8350 based Computer that has a lot more memory, using WSL --import. The export and import was successful but now the distro fails to start with the message “The Windows Subsystem for Linux instance has terminated.” One thing I noticed is that if I convert the Distro from WSL v2 to WSL v1 the distro starts and im able to get into most of it. But a lot of things in the distro dont work. As soon as I convert it back to WSL v2 it fails again. Both the old and new computer are the same build of Windows 10

  • What’s wrong / what should be happening instead: The distro should start.

  • Strace of the failing command, if applicable: (If some_command is failing, then run strace -o some_command.strace -f some_command some_args, and link the contents of some_command.strace in a gist here).

  • For WSL launch issues, please collect detailed logs.

lxcore_service.zip

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 14
  • Comments: 108 (2 by maintainers)

Most upvoted comments

wsl --shutdown ; wsl solved it for me.

I ran wsl --shutdown then wsl and it started working again.

This is becoming really annoying. 😢 I get this error every time I turn on the PC and open the WSL console (Ubuntu-18.04).

Try restarting your LxssManager from windows services.

I have the same problem. My Ubuntu distro stopped working, If I convert it to WSL1 it starts working, but when I move it back to wls 2, I can’t start it again.

EDIT: I founded what caused the problem in my distro. I have mounted folder which require “sshfs” and is in a VPN network. I couldn’t start Ubuntu because my VPN wasn’t started.

Quick solution: (1):

  • Check the state of the wsl instance (wsl --list --verbose)
  • if your wsl instance state is ‘running’ then terminate (wsl -t DISTRO_NAME)
  • then shutdown the instance (wsl --shutdown)
  • now the instance should work fine.

(2):

  • Check the state of the wsl instance (wsl --list --verbose)
  • if your wsl instance state is ‘stopped’ then shutdown the instance (wsl --shutdown)
  • restart the instance, it should work fine.

I’ve seen several issues that seem similar to this and to me the most frustrating things are: 1.) There doesn’t appear to be a good way to see anything that is happening to even begin to troubleshoot this. I know we can collect logs but I haven’t seen a good way to view anything useful from them without having the source code. 2.) The only responses I have seen from Microsoft were asking to submit logs but no acknowledgement of any issues or replies given after those logs were submitted to help anyone get past the issue.

I’ve now had this happen to me twice where I had a great working wsl setup then all of a sudden it just stopped working with this same error. I can export it and re-import it and the same thing happens (this leads me to believe it’s some sort of state in the file system but I have no idea how to track down what saved state to modify in the exported tar file to get it to work after re-import). The second time I should have known better than to mess with things but I saw there was a new kernel update, I installed it, then terminated the distro to get the new kernel version to take affect and it never started up again.

Is there any way to see something like dmesg type output from when an instance (distribution) tries to transition from “Stopped” to Running?

Facing the same issue when using WSL 2 with Docker Desktop

I had this issue recently on my windows and all I did to resolve it was shutdown WSL and start WSL again.

wsl --shutdown then wsl

same here, i think its my fstab, but no way to edit it without starting wsl… bit of a catch 22…

Had to convert back to WSL 1, edit the fstab, then convert again to WSL 2.

how did you manage to do this, having the same issue here. WSL 2 sounded very promising with the performance dreams but I don’t know if all this stress is worth it

i mean you are running an insider preview, this is bound to happen. Wait until actual release and it’ll probably be buttery smooth

I had the same issue. And I tried to run again the command wsl --set-default-version 2 on PowerShell and hourra it works again. I guess you need to run this command each time you restart your PC to choose the version of wsl you want to run.

I ran wsl --shutdown then wsl and it started working again.

This is the way.

exiting docker, opening a new wsl window and restarting docker gets me out of this loop

Facing the same issue when using WSL 2 with Docker Desktop

Same here

I have no idea what happened, but yesterday on a whim, I ran wsl in PowerShell, which seemed to start the instance, and I’ve been able to use it ever since.

After I Updated the WSL 2 Linux kernel, the problem fixed.

image

Notice, Need to download and install the latest package on https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel.

The same problem, sometimes I even have to restart 2-3 times a day, which seriously affects my development, i just use wsl --shutdown

No progress on this? I’ve been experiencing this every 1-2 days, it’s really annoying as i have a lot of stuff that i need to set to get my dev environment running.

Do we have any update on this? It happens to me over and over, restart computer was quite annoying, guys Can any workaround work for now?

PowerShell >> wsl.exe --shutdown
PowerShell >> wsl.exe

that sometimes helps. Sometimes fast to do, sometimes takes time to proceed …

Run as Admin is needed though

Noted little above : https://github.com/microsoft/WSL/issues/5110#issuecomment-672366271

I have the same issue after every clean boot. Using Ubuntu 20.04 with WSL2 on W10 Pro 20152.rs_prerelease.200617-1502.

I run Ubuntu after waiting for the startup processes to finish what they are doing. So no conflict. The terminal gives the specified error: image

The next behavior depends on how much I wait after getting this error. If I wait long enough and open a PowerShell as admin, then run wsl, it starts Ubuntu normally.

In other cases, it waits for 30-45 seconds after running wsl and gives the following error:

The virtual machine or container was forcefully exited

Then I do wsl --shutdown and if I haven’t waited long enough, it would tell me that the program is being used by another process. If I tried again after 1 minute or so, it executes the command. After that, if I try running wsl again, it gives me the same error:

The virtual machine or container was forcefully exited

If I restart Windows after that, I can run Ubuntu just by clicking the Ubuntu button or opening a Linux shell anywhere.

I will try to add the actual screenshots of the errors as this issue reproduces itself circumstantially.

Hi! I had the same issue, the below steps solved it for me 👍

  1. pause docker-engine
  2. close all apps accessing Linux files (e.g. vscode)
  3. Power shall ( to check the distro name): $ wsl -l -v
  4. Power shall ( to start the WSL distributuion again): $ wsl -d Ubuntu-18.04

Execute wsl --list to get what you have now, and then execute wsl --set default [name], which perfectly solves the problem

I’ve been struggling with this issue for the last couple of days as well. For me, it looks like the failure was related to the network shares (all cifs) that I was trying to mount via /etc/fstab

I was able to workaround it as such:

  1. Stop LxssManager service via CTRL+SHIFT+ESC
  2. Rename ext4.vhdx to ext4-broken.vhdx (location: %LOCALAPPDATA%\Packages\CanonicalGroupLimited.UbuntuonWindows_…\LocalState)
  3. Reinstall Ubuntu, which will create a new ext4.vhdx
  4. Launch WSL
  5. Mount ext4-broken.vhdx using guestmount:
  • sudo apt update
  • sudo apt install libguestfs-tools
  • sudo apt install linux-image-generic
    • This is necessary because guestmount will fail when it can’t find anything in /boot/
  • sudo guestmount --add /mnt/c/Users/callee/AppData/Local/Packages/CanonicalGroupLimit ed.UbuntuonWindows_…/LocalState/ext4-broken.vhdx -i /mnt/dead
  1. Edit the misbehaving /etc/fstab
  • sudo su
    • I probably messed up my mounting permissions here, because I couldn’t access /mnt/dead as a normal user…
  • vim /mnt/dead/etc/fstab
  • Commented out all of my network shares (added # to the start of the line)
    • hit I to go into Insert Mode
    • hit <ESC> -> wq -> <ENTER> to save
  • exit
  • exit
  • wsl --terminate Ubuntu
  1. Stop LxssManager service again via CTRL+SHIFT+ESC
  2. Rename ext4.vhdx to ext4.vhdx.bak
  3. Rename ext4-broken.vhdx to ext4.vhdx
  4. Run wsl again

I can’t install the WSL kernel update either, as the installer is assuming I don’t have WSL.

how did you manage to do this, having the same issue here.

wsl --set-version Ubuntu-18.04 1
# edit fstab
wsl --set-version Ubuntu-18.04 2

where Ubuntu-18.04 is the distribution I use.

Fun fact: all the mounts in the fstab work if I execute them after the machine is up (sudo mount ...) → feels like a startup order problem.

Had to convert back to WSL 1, edit the fstab, then convert again to WSL 2.

oh god.

Yeah, debugging functionality in WSL still needs to improve. But at least I can FUSE mount now in WSL 2 which completes the last of my requirements for development on WSL.

wsl command was failing for me, but after ejecting my external HD it worked fine and WSL has been started.

For most of the issues. I just apply what we call a “Microsoft” solution.

Restart of WSL.

Run powershell as admin >> wsl --shutdown >> Start “Ubuntu on Windows” again from the start button.

Close and open VScode again and it’s solved.

I ran wsl --shutdown then wsl and it started working again.

This is the way.

Do you realize, that this is like telling someone whose wifi driver is sometimes starting to drop packets to fix the issue by rebooting his laptop? 🙄

https://github.com/microsoft/WSL2-Linux-Kernel/releases/tag/linux-msft-wsl-5.15.57.1

The first 5.15 kernel series was released Aug 2nd, and running wsl --update nicely updated me to that version.

Regarding the changelog:

Fix 9p filesystem regressions since the last v5.10 WSL2 kernel

Would that be related to our long awaited fix?

Also, did anyone try the PATH workaround in the discussion? https://github.com/microsoft/WSL/discussions/7869

same issue for me. Restarted last night after applying updates and cannot launch a previously working distro.

creating a new distro works as expected.

docker running or not running makes no difference

Microsoft Windows [Version 10.0.19041.388]

Similarly here.

The Windows Subsystem for Linux instance has terminated.
[process exited with code 4294967295]

I think it might be due to changes to /etc/fstab I’ve done - is there a way to edit the file without starting WSL? Or maybe it is because of the docker service.

Log capture does not provide any additional information:

logman.exe create trace lxcore_kernel -p "{0CD1C309-0878-4515-83DB-749843B3F5C9}" -mode 0x00000008 -ft 10:00 -o .\lxcore_kernel.etl -ets
logman.exe create trace lxcore_user -p "{D90B9468-67F0-5B3B-42CC-82AC81FFD960}" -ft 1:00 -rt -o .\lxcore_user.etl -ets
logman.exe create trace lxcore_service -p "{B99CDB5A-039C-5046-E672-1A0DE0A40211}" -ft 1:00 -rt -o .\lxcore_service.etl -ets

→ Event Viewer info is barren.

Serious problem for me is that I have files on Linux “partition”, shared them via \wsl$ to Windows folder and I use it for development. When WSL crashes, InteliJ Idea fails to write file, freezes and file is empty after restart. So my last work is lost and I have to commit more often.

Would this issue be fixed by the 0.60.0 release of this week? https://github.com/microsoft/WSL/releases/tag/0.60.0

Do we have any update on this? It happens to me over and over, restart computer was quite annoying, guys Can any workaround work for now?

Hi,

Using WSL2 with Ubuntu 20.04 For me it was that I had two versions of docker installed

    Powershell > docker --version  (docker desktop)
    WSL > docker --version 

So I uninstalled docker desktop, and to completely remove the docker version in WSL I followed the steps below. After that reinstalled only docker desktop (and in settings > resources > enabled WSL2 for my distribution

To completely uninstall Docker:

Step 1

dpkg -l | grep -i docker To identify what installed package you have:

Step 2

sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli (##choose the docker from step 1 for me it was docker.io)

sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
The above commands will not remove images, containers, volumes, or user created configuration files on your host. If you wish to delete all images, containers, and volumes run the following commands:

sudo rm -rf /var/lib/docker /etc/docker sudo rm /etc/apparmor.d/docker sudo groupdel docker sudo rm -rf /var/run/docker.sock You have removed Docker from the system completely.

Install now only docker desktop and > settings > resources > enable WSL2 and select your Distribution

I haven’t seen that error as often as I first did, so I assume that they indeed are working on fixing it and/or improving it. But in the event I do see it again, I have a link on my Desktop at the ready that automatically restarts the service and at the same time clears the error. The shortcut points to a script file in which I have the following content:

@echo off
REM - Restart LxssManager Service

echo Restarting LxssManager Service...

powershell -Command "Restart-Service -Name LxssManager -PassThru -Force"

TIMEOUT 10

REM - Uncomment below line to troubleshoot.
REM - pause

exit 0

WSL was working for a few weeks without any problems, then I restarted my PC and now I’m seeing the “The Windows Subsystem for Linux instance has terminated.” message every time I try to start WSL.

Microsoft Windows [Version 10.0.19042.867]

— Process 16452 created — Process 16452 loaded C:\Windows\System32\ntdll.dll at 00007ffd22930000 — Process 16452 loaded C:\Windows\System32\kernel32.dll at 00007ffd21e70000 — Process 16452 loaded C:\Windows\System32\KernelBase.dll at 00007ffd204e0000 — Process 16452 loaded C:\Windows\System32\apphelp.dll at 00007ffd1cb30000 — Process 16452 loaded C:\Windows\System32\ucrtbase.dll at 00007ffd203e0000 — Process 16452 thread 8620 created — Process 16452 loaded C:\Windows\System32\SHCore.dll at 00007ffd227a0000 — Process 16452 loaded C:\Windows\System32\msvcrt.dll at 00007ffd22590000 — Process 16452 loaded C:\Windows\System32\combase.dll at 00007ffd20b70000 — Process 16452 loaded C:\Windows\System32\rpcrt4.dll at 00007ffd20990000 — Process 16452 thread 6736 created — Process 16452 thread 1684 created — Process 16452 loaded C:\Windows\System32\ws2_32.dll at 00007ffd21f40000 — Process 16452 loaded C:\Windows\System32\kernel.appcore.dll at 00007ffd1e960000 — Process 16452 loaded C:\Windows\System32\bcryptprimitives.dll at 00007ffd20910000 — Process 16452 loaded C:\Windows\System32\sechost.dll at 00007ffd22100000 — Process 16452 loaded C:\Windows\System32\clbcatq.dll at 00007ffd226f0000 — Process 16452 thread 18524 created — Process 16452 thread 17008 created — Process 16452 thread 10420 created — Process 16452 loaded C:\Windows\System32\lxss\LxssManagerProxyStub.dll at 00007ffd1a300000 — Process 16452 thread 1684 exited with status 0x0 — Process 16452 thread 6736 exited with status 0x0 — Process 16452 thread 8620 exited with status 0x0 — Process 16452, exception e06d7363 at 00007ffd2050d759 — Process 16452 unloaded DLL at 00007ffd1a300000 — Process 16452, exception e06d7363 at 00007ffd2050d759 — Process 16452 thread 17008 exited with status 0xffffffff — Process 16452 thread 18524 exited with status 0xffffffff — Process 16452 thread 10420 exited with status 0xffffffff — Process 16452 exited with status 0xffffffff

I had this issue before when I rebooted my Windows. I think it assuems that the WSL is not running, and tries to start it again. I’ve fixed it by ternimating the running WSL, by running this commad wsl --list --running you will list all running wsl, then run this command wsl --terminate {YOUR RUNNING WSL} to terminate the wanted WSL. After that you wil get it running again.

I am having the same issue suddenly after restarting my machine. Trace files attached. Microsoft Windows [Version 10.0.19041.388] Ubuntu-20.04 lxcore_trace.zip

I had the same problem after switching to WSL2. I launched the bash on Ubuntu shortcut and there was still some setup to be done. After it did that I am able to launch it from the terminal again. Yay!

same here, i think its my fstab, but no way to edit it without starting wsl… bit of a catch 22…

Had to convert back to WSL 1, edit the fstab, then convert again to WSL 2.

how did you manage to do this, having the same issue here. WSL 2 sounded very promising with the performance dreams but I don’t know if all this stress is worth it