WSL: Error code: Wsl/Service/E_UNEXPECTED
Version
Microsoft Windows [Versión 10.0.19045.2486]
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.15.79.1
Distro Version
Ubuntu 22.04
Other Software
No response
Repro Steps
steps taken until I got the error, in a fresh OS installation
- Activate systemd
sudo nano /etc/wsl.conf
[boot] systemd=true
wsl.exe –shutdown
-
Install webmin sudo nano /etc/apt/sources.list → deb https://download.webmin.com/download/repository sarge contrib wget https://download.webmin.com/jcameron-key.asc cat jcameron-key.asc | gpg --dearmor >/etc/apt/trusted.gpg.d/jcameron-key.gpg sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install webmin
-
install webinoly (lemp) wget -qO weby qrok.es/wy && sudo bash weby -clean sudo stack -php-ver=8.1 sudo stack -mysql-ver=10.6 sudo stack -lemp
So far so good, all services work properly.
Expected Behavior
When closing the console window where the linux operating system is open, the WSL is expected to stop all services in the background and turn off the virtual machine.
Actual Behavior
When I start the application again I get the following error:
Fatal Error Error code: Wsl/Service/E_UNEXPECTED press any key to continue
and then the window closes.
Diagnostic Logs
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 44 (6 by maintainers)
WslLogs-2023-04-14_07-19-36.zip
For me WSL runs great initially. I notice this issue if I come back to work after a big gap. Once I hit the error, wsl --shutdown is useful.
I am running the following: snapd, microk8s and I use VSCode plugin for WSL.
I had the same error today.
wsl.exe --shutdownfixed it on my maschine.worked for me
In my case, disable docker-desktop
Resource Saverthe same error, and
wsl.exe --shutdownworkThis is happening to me as well since few months and it is very annoying as I need to restart the wsl2 each time All my dev environment is on wsl2 Can we have a ETA for a fix ?
Every time the PC wakes from hibernation, WSL crashes with the error: Wsl/Service/E_UNEXPECTED.
crazy this error is 2 years old: https://github.com/microsoft/WSL/issues/9490#issuecomment-1508653832
i bet it’s something to do with sleep mode or battery saving
Anyone at Microsoft/WSL team actually looking into this? Only 2 years down the line…
Getting the same error every time i put my machine to sleep, Windows 11. Ubuntu as my only distro (dont want to have to start ‘tricking’ the system by installing a dummy linux distro just to get this to work)…
same error: Error code: Wsl/Service/E_UNEXPECTED please.
Have anybody tried the solution proposed on this thread?
https://learn.microsoft.com/en-us/answers/questions/1312694/error-code-wsl-installdistro-e-unexpected-catastro
Same thing happens for me after I bring it back on from sleep.
I just saw this issue and it did happen after my laptop had been put to sleep and left overnight.
Had to check some work stuff so didn’t have the time to get logs but if this happens again, I will try to re-activate and submit logs.
Honestly losing faith in WSL now as I feel like I can’t trust it anymore. Network issues. Sleep/Stability issues …
This just happened to me
I just restarted wsl like this:
wsl --shutdown; wslBack in business after this. No need to restart the computer. Thumbs up if this worked for you.
This is just happen to me today. I have found my solution after searching on internet :
wsl --shutdown wsl --update wsl --install
after restart my computer, all worked fine.
This is happening almost every time my machine resumes from hibernation on my aarch64 Surface Laptop 7. Given I work primarily in WSL2 on Rust and Go, this is productivity killer since I lose time, any env vars or some command history, etc.
Come here when mounting physical disk for ext4 partition.
Using
--partition 1workingI found that only the first/default distro is affected. So, if you have this problem, install Ubuntu as default, then install other distro that you want to use. You’ll see that the default distro will become invalid a few days/months before, but not your selected distro (and idk why tbh).
I’m using Kali as secondary/base use and, apart from Ubuntu returning a 'Service E/Unexpected ', Kali is working flawless. 🤷
it’s not the same issue. Ubuntu works great. I use it everyday. then when the system goes to sleep, and wakes up, no new sessions can start (shells). but the existing sessions work fine.
On Tue, Jun 3, 2025, 3:38 PM victorasantos10 @.***> wrote:
i repro’ed it just now and collected logs, are you sure the logs don’t contain sensitive information though? can i post them here, or should i DM/upload securely. honestly, this issue is the #1 reason i might need to dual-boot, so it would be cool if it got fixed to save that hassle
wsl --shutdownworks at first, but every time when i reopen it, it crash again…same error
it somehow automagically revived itself? installed the rest of the bundle (when i say bundle i mean the packages listed among “the following NEW packages will be installed” thing). working amazing so far
For me, ubuntu is the one failing after sleep. If I just go on the Start Menu and search for WSL and press enter, it works. However the Ubuntu distro (which is where my dev containers are running) always stay unresponsive.
Maybe the best approach until M$ does something is just to cut off the sleep function, so I don’t need to reload all my VSCode windows…
Just started happening to me this morning, everything has been working fine for about a month up until now
How do you start your wsl?
@Taco0220, If you need to restore the WSL “machine” (to recover files, etc.), see if this approach can help you: https://stackoverflow.com/a/76354545/1493870
It’s not the solution to this issue. Only a way to get back the files inside the WSL.
this just happened to me after shutting down my ubuntu distro and then rebooting (after installing a few packages from the ubuntu-desktop bundle)
please help, that distro has a lot of important stuff on it