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)

Most upvoted comments

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.

Linux home-pc 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID: Ubuntu
Description:    Ubuntu 22.10
Release:        22.10
Codename:       kinetic

I am running the following: snapd, microk8s and I use VSCode plugin for WSL.

I had the same error today. wsl.exe --shutdown fixed it on my maschine.

wsl.exe --shutdown

worked for me

In my case, disable docker-desktop Resource Saver

the same error, and wsl.exe --shutdown work

This 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.

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; wsl

Back 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.

$ wsl --mount \\.\PHYSICALDRIVE2
Catastrophic failure
Error code: Wsl/Service/DetachDisk/E_UNEXPECTED

Using --partition 1 working

$ wsl --mount \\.\PHYSICALDRIVE2 --partition 1

I 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:

victorasantos10 left a comment (microsoft/WSL#9490) https://github.com/microsoft/WSL/issues/9490#issuecomment-2937489983

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

image.png (view on web) https://github.com/user-attachments/assets/fcd1882d-cc03-44d4-8edc-cd126c7868e6

— Reply to this email directly, view it on GitHub https://github.com/microsoft/WSL/issues/9490#issuecomment-2937489983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMMUL5O2JBZGLZROCPD233BYPXPAVCNFSM6AAAAAAT5INEO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMZXGQ4DSOJYGM . You are receiving this because you commented.Message ID: @.***>

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 --shutdown works 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

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. …

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

wsl --shutdown works at first, but every time when i reopen it, it crash again…

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