I ran
wsl --shutdown
thenwsl
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? 🙄
Well, truth be told, if this is Dell hardware a reboot actually can be a correct answer. For some Dell hardware I supported over the years, one had first to turn off the device, unplug the device from power for 15 seconds, and then plug it back in and boot up the computer again. Had much experience with Dell hardware in a College computer Math Lab that had issues with dropping packets until that was done. All of the computers would do it. Had to do this about every couple of weeks or so with the 3Com hubs and switches that were in use at the time. And it was similar with the Wifi hardware. I don’t what it was about the Dells at that time, but it was a regular occurrence. They all were Optiplex models, but I no longer recall the specific model numbers. Some Dell Inspirons would do the same with their Wifi hardware. It did not matter what settings were used. Even worse, some Dell models were certified for Ubuntu, but the Wifi hardware always had issues with dropping packets until rebooted (in which case it would be fine for a few days before problems would start up again), and we never could get hibernation to work properly on those systems supposedly certified for Ubuntu Linux!
Long rant about the way things were, but I also have found that when there are troubles with WSL, shutting it down and starting it up again would fix the troubles with interoperability. After some updates, the problem came back with a vengeance, and I found I had to run the command several times a day. So, I just wrote a couple of scripts so that when it occurs, I just double click a shortcut to the main script, click to allow elevation, and let it shutdown WSL, restart the service, and then restart WSL and run a few services from the Linux side (such as CUPS, saned, and systemwide DBus). This is the script I now am using (until changes to WSL require modification):
@echo off
REM - Shutdown and terminate Linux WSL VM.
echo Shutting down running WSL Linux instance...
wsl --shutdown
echo WSL Linux session terminated...
TIMEOUT 5
REM - Restart LxssManager Service.
echo Restarting LxssManager Service...
powershell -Command "Restart-Service -Name LxssManager -PassThru -Force"
TIMEOUT 10
REM - Start Linux WSL VM and services.
"C:UsersPublicPublic Virtual MachinesScriptsStartWSL.cmd"
REM - Uncomment below line to troubleshoot.
REM - pause
exit 0
The Start WSL script is as follows (the script can be adjusted for either use of WSLg or the third party XServer I was using):
@echo off
REM - Start XServer.
REM - "C:Program FilesVcXsrvvcxsrv.exe" +bs -ac -multiwindow -multimonitors -wgl -swrastwgl
REM - Allow XServer time to start.
REM - timeout /t 10 /nobreak >NUL
REM - Update WSL Kernel and components.
REM - C:WindowsSystem32wsl.exe --update
REM - Allow update process to close.
REM - timeout /t 5 /nobreak >NUL
echo Starting WSL Linux...
:RETRY
REM - Run some WSL Services.
REM - C:WindowsSystem32wslg.exe -d Ubuntu -- /usr/bin/start-wsl-services
C:WindowsSystem32wslg.exe -d Ubuntu -- /usr/bin/start-wsl-services
REM - IF %ERRORLEVEL% NEQ 0 (GOTO RETRY)
REM - Allow time to see all results.
timeout /t 2 /nobreak >NUL
REM - Uncomment below line for troubleshooting.
REM - pause
exit 0
And on the Linux side of WSL, I use the following script (with several available options) named start-wsl-services in /usr/bin/:
#!/bin/bash
# Check for and run System-wide DBus service.
SERVICE="dbus-daemon"
if pgrep -x "$SERVICE" >/dev/null
then
pgrep -a "$SERVICE"
else
sudo /etc/init.d/dbus start
pgrep -a "$SERVICE"
fi
# Check for and run CUPS Printing Service.
SERVICE="cupsd"
if pgrep -x "$SERVICE" >/dev/null
then
pgrep -a "$SERVICE"
else
sudo /etc/init.d/cups start
pgrep -a "$SERVICE"
fi
# Check for and start Freshclam CLAMAV Update service.
SERVICE="freshclam"
if pgrep -x "$SERVICE" >/dev/null
then
pgrep -a "$SERVICE"
else
sudo /etc/init.d/clamav-freshclam start
pgrep -a "$SERVICE"
fi
# Check for and start SANED Scanner service.
SERVICE="saned"
if pgrep -x "$SERVICE" >/dev/null
then
pgrep -a "$SERVICE"
else
sudo /etc/init.d/saned start
pgrep -a "$SERVICE"
fi
# Check for and start Preload service.
SERVICE="preload"
if pgrep -x "$SERVICE" >/dev/null
then
pgrep -a "$SERVICE"
else
sudo /etc/init.d/preload start
pgrep -a "$SERVICE"
fi
# Start LibreOffice and terminate for faster loading (uncomment to use).
# /usr/bin/libreoffice --terminate_after_init
# Check for error, make sure all functions called and run, and pass the result on to calling process.
if [[ $? -ne 0 ]] ; then
exit 1
else
exit 0
fi
I have recently upgraded to Windows 10 Version 2004 and installed WSL 2 with Ubuntu-20.04.
When I am trying to access the WSL 2 I am getting the below error
The Windows Subsystem for Linux instance has terminated.
[process exited with code 4294967295]
I have already installed wsl2-kernel when I have upgraded from WSL1 to WSL2.
The problem resolved after the system restart. However, the issue may come again
oh ok. yeah, I can’t help u there, I skipped WSL1 and went to WSL2.
Hey @chandralanka2 I’ll mark this issue as closed for now since it seems resolved via the restart, however if you do experience it again please don’t hesitate to reopen it! Thank you for filing this issue
Hey @chandralanka2 I’ll mark this issue as closed for now since it seems resolved via the restart, however if you do experience it again please don’t hesitate to reopen it! Thank you for filing this issue
It happened randomly,i did wsl —export then wsl —import to change the ubuntu20.04 location
degerister wsl and re-register.
degerister wsl and re-register.
I randomly experienced this issue after my computer had been running for a couple days. WSL working fine for 2 years prior. I took off WSL from the Windows Features On/Off dialog and turned it back on. I also started «Host Network Service» but this does nothing.
I was able to get another VM in the wsl -l -v
list to start, but my Debian instance just fails. I get:
The Windows Subsystem for Linux instance has terminated.
I have no idea how to fix. I suspect a harddrive corruption of some kind. Yet — I am able to launch Windows itself fine. Where would I even start to repair this?
degerister wsl and re-register.
I randomly experienced this issue after my computer had been running for a couple days. WSL working fine for 2 years prior. I took off WSL from the Windows Features On/Off dialog and turned it back on. I also started «Host Network Service» but this does nothing.
I was able to get another VM in the
wsl -l -v
list to start, but my Debian instance just fails. I get:
The Windows Subsystem for Linux instance has terminated.
I have no idea how to fix. I suspect a harddrive corruption of some kind. Yet — I am able to launch Windows itself fine. Where would I even start to repair this?
I have been able to solve this problem by converting the instance to WSL1 then the problem is gone. But resolving this for WSL 2 required removing the changes I made on /etc/fstab and convert it back to wsl 2.
Same problem here.
WLS 2 crashes randomly.
Same problem here.
WLS 2 crashes randomly.
Did you change anything recently on /etc/fstab? If you did, try following the steps I described previously.
I have been able to solve this problem by converting the instance to WSL1 then the problem is gone. But resolving this for WSL 2 required removing the changes I made on /etc/fstab and convert it back to wsl 2.
No changes on fstab.
I have upgraded from WLS 1 to WLS 2 a couple of weeks ago and everything was working perfect.. Suddenly, my WLS started to crashes… It usually crashes 1 or 2 times every day. I could not find any logs on my linux instance, and nothing relevant on windows logs…
I also got this message «The Windows Subsystem for Linux instance has terminated» when I reboot. If I try again later (~30 minutes), it’s working. Just like the subsystem takes a lot of time to boot correctly.
Same issue: «The Windows Subsystem for Linux instance has been terminated.» This is on a fresh install after trying to make a new tab in windows terminal. Interestingly, the existing Linux tab is still functioning.
Same here as @alexanderKubra here.
For me helps to reinstate possibility to log to terminal.
wsl.exe --shutdown
wsl.exe
In any case it is like 1 minute to proceed these 2 steps and then I have to reopen all the terminals what was still open and otherwise working as they exited due shutdown ..
It is happening to me now on WSL 2 on Windows 11.
I have been using Ubuntu 20.04 on WSL2 daily for the past one year. Yesterday I ran sudo apt update && sudo apt upgrade
in the Ubuntu distro. After a reboot on my Windows 10 machine, I can’t launch the Ubuntu distro anymore. I am getting The Windows Subsystem for Linux instance has terminated. process exited with code 4294967295
in my Windows Terminal.
My Windows version is Windows 10 2004
Is there any ways to fix it or get files out from Ubuntu distro?
My bottomline is to save any working files inside the Ubuntu distro.
asked Mar 29, 2022 at 3:15
3
I shutdown the wsl and restarted. That did it for me.
To Shutdown:
wsl --shutdown
To Start:
- Just started the Ubuntu app
answered Oct 2, 2022 at 17:28
Managed to solve it by removing NAS storage entry in /etc/fstab
. Ubuntu in WSL2 will fail to start if the connection to NAS storage fail.
Found the solution in this github issue.
answered Apr 1, 2022 at 9:22
IsaacIsaac
911 gold badge1 silver badge4 bronze badges
Open PowerShell
as Administrator
Enable the Windows Subsystem for Linux
optional component
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
To install WSL, your Windows 10 must be at least version 2004
. Run winver
to check you windows version, and run Windows Update if required.
Enable the Virtual Machine Platform
optional component
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Set WSL 2 as your default version
wsl --set-default-version 2
If it show Invalid command line option: --set-default-version
, it probably means you are on WSL1 (where you Windows is less than version 2004
)
If it show
WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel
Follow the instruction to install Linux kernel update package
.
If successful, it will show
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Visit Microsoft Store to install Ubuntu. I select Ubuntu 20.04 LTS
.
Installing, this may take a few minutes...The Windows Subsystem for Linux instance has terminated.Please create a default UNIX user account. The username does not need to match your Windows username.For more information visit: https://aka.ms/wslusersEnter new UNIX username: New password:Retype new password:passwd: password updated successfullyInstallation successful!
You might want to update Ubuntu and its packages
sudo apt-get update && sudo apt-get upgrade
You can check you WSL version through PowerShell
wsl --list --verbose NAME STATE VERSION* Ubuntu-20.04 Running 2
References:
- https://docs.microsoft.com/en-us/windows/wsl/install-win10
❤️ Is this article helpful?
Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.
Do send some 💖 to @d_luaz or share this article.
✨ By Desmond Lua
A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz
👶 Apps I built
Travelopy — discover travel places in Malaysia, Singapore, Taiwan, Japan.
Occasionally WSL hangs on Windows 10. Opening «Ubuntu» bash just hangs. Any way to restart WSL without rebooting Windows ?
10 Answers
To expand on kev’s answer, you need to restart the LxssManager
service. This can be done by opening Task Manager with CTRL
SHIFT
ESC
, going to the Services
tab, finding the LxssManager
service, right-clicking and selecting Restart
.
I believe the most effective way today for WSL2, in Cmd Prompt:
wsl --shutdown
You can shut down Ubuntu by using wslconfig
(in Windows Command Prompt or PowerShell):
wslconfig /t Ubuntu
and it will start automatically next time you open a shell.
shutdown windows-service Lxss-Manager
go to windows setting -> Apps & features -> select ubuntu you installed -> click Advanced options(might need to wait a little bit) -> Terminate
From the windows command prompt, issue wslconfig /L to see the list of registered distributions.
C:UsersManoj>wslconfig /L
Windows Subsystem for Linux Distributions:
Ubuntu-16.04 (Default)
Now issue wslconfig /t
C:UsersManoj>wslconfig /t Ubuntu-16.04
You can then see the Ubuntu instance getting terminated.
[email protected]:~$ The Windows Subsystem for Linux instance has terminated.
Press any key to continue...
Hope this helps.
Assuming your wsl distribution name is Ubuntu
.
You can use wsl
command in Command Prompt
(cmd) to find out distribution names and terminate / shutdown / restart a specific distribution.
Restart in sense that you shutdown your wsl distribution and start it again.
- Open cmd.
- Use
wsl -l
orwsl --list
to list / show all installed distributions. It’ll give you output like this. The(Default)
is not part of name, just a marker.
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
Ubuntu-20.04
Ubuntu-18.04
- Terminate / shutdown your desired distribution using
wsl -t
orwsl --terminate
like
wsl --terminate Ubuntu
and it will start automatically next time when you open it.
Open powershell
with admin privileges and type the below command to restart the lxxsManger
:
Get-Service LxssManager | Restart-Service
I have this problem sometimes too. I just press Ctrl+C and it goes back to «normal»
While the other solutions work as well, I like this concise command for Windows PowerShell or cmd:
wsl -t Ubuntu
To see which distributions are installed, you can run wsl -l
.