You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"An existing connection was forcibly closed by the remote host." error is presented when launching any WSL 2 distro #4105
Your Windows build number: Microsoft Windows [Version 10.0.18917.1000]
What you're doing and what's happening:
Trying to launch wsl.exe or bash throws an error message that states An existing connection was forcibly closed by the remote host.
Microsoft Windows [Version 10.0.18917.1000]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Steven>bash
An existing connection was forcibly closed by the remote host.
C:\Users\Steven>wsl
An existing connection was forcibly closed by the remote host.
C:\Users\Steven>
I've tried this with my converted Debian distro, as well as ArchWSL. I also tried to install Ubuntu but during setup after choosing my UNIX username the same error gets thrown.
What's wrong / what should be happening instead:
The distro should be launching normally and I should be presented with a bash shell.
Edit (9/26/19):
It appears that the number of entries in a modified hosts.txt is what is causing this issue at the moment. More information here: #4105 (comment)
Reacted by andreluizgit, Omri, Nishikinor, TKong, Soberia and Axis
Me too. Same build 18917 and Debian, I converted it to Wsl version 2 but the Appx can't run after this convertion... Then I returned to Wsl version 1.
The issue can be the ext4.vhdx disk image that can't be open from Appx (Debian or Ubuntu) with Wsl2, before the linux files could be open via explorer with Wsl1.
Thanks for filing. From the trace it looks like your instance is being terminated during creation. Does the following command work? If so can you give me the output? When you're in this state, can you look in task manager and see if there is a vmmem process running?
wsl.exe -u root -e dmesg
Thanks!
Reacted by andreluizgit, Saeed Norouzi, wwwvmware, Phan Văn Tiến, James Hinns, Benjamin Senst and 33YANG
Thanks for filing. From the trace it looks like your instance is being terminated during creation. Does the following command work? If so can you give me the output? When you're in this state, can you look in task manager and see if there is a vmmem process running?
wsl.exe -u root -e dmesg
Thanks!
That command doesn't work; I'm still getting the original An existing connection was forcibly closed by the remote host. message, but there is heightened Vmmem activity when I call this for sure (I tried calling it repeatedly and noticed the spike).
Thanks for filing. From the trace it looks like your instance is being terminated during creation. Does the following command work? If so can you give me the output? When you're in this state, can you look in task manager and see if there is a vmmem process running?
wsl.exe -u root -e dmesg
Thanks!
Microsoft Windows [Version 10.0.18917.1000]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Steven>wsl.exe -u root -e dmesg
An existing connection was forcibly closed by the remote host.
C:\Users\Steven>
This is what I see in task manager shortly after running that command
The the first running vmmem process will stick around for a bit before disappearing, while the second one stays in its suspended state indefinitely
Would it be possible for somebody hitting the "An existing connection was forcibly closed by the remote host" issue to export your distribution and share the tar file? This will contain your entire root file system so if there is private information please send it to [email protected].
wsl.exe --export DistroName FileName.tar
Zip FileName.tar
Email to [email protected], say it's for benhill, or upload and send me a link.
Then only the ext4.Vhdx image converted (after change to WSL2) would be need
Idk about you, but I'm experiencing it on a plain clean downloaded Ubuntu and Debian (and Kali) WSL instance so I'm not sure why it's needed at all
I understood. Only problem with wsl2 is that it create a disk image and the Appx (Debian or Ubuntu) can't run
If it helps, I don't think other optional features are interfering as I spent 15 mins switching between to see and no change. It's not due to other Hyper-V either.
If it helps, I don't think other optional features are interfering as I spent 15 mins switching between to see and no change. It's not due to other Hyper-V either.
Me too. I tried enable & disable Hyper-V feature with Virtual Machine Platform enabled but This disk image "ext4.vhdx" Can't be Mounted
Thanks for the information. I've since dropped out of receiving Insider builds and have reinstalled Windows 10 on my PC, but I believe I did have a custom hosts.txt file for ad-blocking before I did all of that.
Hi there!, I had really hard time to set WSL2, at each update I had retry without success and look back to this issues to see any improvement.
But thanks to all of you! I would finally be able to use Docker with WSL2!
I had manually added some remote hosts to /etc/hosts under Ubuntu WSL2 and that seems to have created the same problem when those hosts ceased to exist and their DNS resolution failed. Deleting the hosts file under System32 as described above and a restart solved it.
Activity
andreluizgit commentedon Jun 13, 2019
Me too. Same build 18917 and Debian, I converted it to Wsl version 2 but the Appx can't run after this convertion... Then I returned to Wsl version 1.
The issue can be the ext4.vhdx disk image that can't be open from Appx (Debian or Ubuntu) with Wsl2, before the linux files could be open via explorer with Wsl1.
Windows Insider forum : https://answers.microsoft.com/en-us/insider/forum/all/an-existing-connection-was-forcibly-closed-by-the-remote-host
benhillis commentedon Jun 13, 2019
Thanks for filing. From the trace it looks like your instance is being terminated during creation. Does the following command work? If so can you give me the output? When you're in this state, can you look in task manager and see if there is a vmmem process running?
wsl.exe -u root -e dmesg
Thanks!
OmriSama commentedon Jun 13, 2019
That command doesn't work; I'm still getting the original
An existing connection was forcibly closed by the remote host.message, but there is heightened Vmmem activity when I call this for sure (I tried calling it repeatedly and noticed the spike).steven-peralta commentedon Jun 13, 2019
This is what I see in task manager shortly after running that command

The the first running vmmem process will stick around for a bit before disappearing, while the second one stays in its suspended state indefinitely
benhillis commentedon Jun 13, 2019
Great thank you. It looks like the utility VM is still alive, it's the distro itself that is running into an issue. I'll dig into this a bit today.
benhillis commentedon Jun 13, 2019
Would it be possible for somebody hitting the "An existing connection was forcibly closed by the remote host" issue to export your distribution and share the tar file? This will contain your entire root file system so if there is private information please send it to [email protected].
andreluizgit commentedon Jun 13, 2019
Can be with WSL 1 actived or must be only wsl2 ? I can run "wsl.exe --export DistroName FileName.tar" with my Debian in WSL1 ? and Then send to you
lzlrd commentedon Jun 13, 2019
I think he wants it in WSL2 format.
andreluizgit commentedon Jun 13, 2019
Then only the ext4.Vhdx image converted (after change to WSL2) would be need
lzlrd commentedon Jun 13, 2019
Idk about you, but I'm experiencing it on a plain clean downloaded Ubuntu and Debian (and Kali) WSL instance so I'm not sure why it's needed at all.
andreluizgit commentedon Jun 13, 2019
I understood. Only problem with wsl2 is that it create a disk image and the Appx (Debian or Ubuntu) can't run
lzlrd commentedon Jun 13, 2019
If it helps, I don't think other optional features are interfering as I spent 15 mins switching between to see and no change. It's not due to other Hyper-V either.
andreluizgit commentedon Jun 13, 2019
Me too. I tried enable & disable Hyper-V feature with Virtual Machine Platform enabled but This disk image "ext4.vhdx" Can't be Mounted
136 remaining items
steven-peralta commentedon Sep 16, 2019
Thanks for the information. I've since dropped out of receiving Insider builds and have reinstalled Windows 10 on my PC, but I believe I did have a custom hosts.txt file for ad-blocking before I did all of that.
KerberosMorphy commentedon Sep 19, 2019
Hi there!, I had really hard time to set WSL2, at each update I had retry without success and look back to this issues to see any improvement.
But thanks to all of you! I would finally be able to use Docker with WSL2!
chdenat commentedon Sep 19, 2019
Glad to have open the door ;)
hsmyers commentedon Sep 19, 2019
zyazhb commentedon Sep 23, 2019
TNX for information hosts is the causion! DELETE hosts fix this.
benhillis commentedon Oct 3, 2019
Fixed in 18995.
lelayf commentedon Nov 6, 2020
I had manually added some remote hosts to /etc/hosts under Ubuntu WSL2 and that seems to have created the same problem when those hosts ceased to exist and their DNS resolution failed. Deleting the hosts file under System32 as described above and a restart solved it.
MarkSCQ commentedon Nov 19, 2020
I dont know why, it seems restart solves everything 😆