Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSL2: Why do I have to shutdown WSL to restart WSL after restarting PC

I have my windows set up WSL with Ubuntu. It has been working fine for a while, until I upgraded to WSL2.

The problem is: every time I start up my PC (or restarting my PC), it lost the connection from Ubuntu to Windows drives.

I got the message like this:

cd: Input/output error: /mnt/d/

The above problem could be solved easily by running this:

wsl.exe --shutdown

I want to solve this problem permanently, instead of shutting down WSL every time I got the problem.

Any idea how to fix this permanently?

like image 539
nnhthuan Avatar asked Sep 13 '20 15:09

nnhthuan


People also ask

How do I restart WSL2 after shutdown?

Right-click on the Lxssmanager service and select the option Restart. This will reboot/restart the windows subsystem for Linux -WSL (Ubuntu, Debian, Kali, OpenSUSE, etc). In the same way to shut down or stop WSL select the STOP option.

How do you power off wsl?

If I have to choose between disable fast startup or re-run wsl --shutdown , then wsl --shutdown takes me only less than 1s (as it's remembered in Windows-R already). This isn't the root cause. It still happens without fast startup. Workaround is just to run wsl.exe --shutdown when you need.


2 Answers

This sounds like a fast startup problem. Try disabling it in the Control Panel.enter image description here

like image 141
Smithienious Avatar answered Sep 25 '22 11:09

Smithienious


I haven't seen this issue anymore from the last 2 months. For more info, I upgraded windows to Windows 11 and always do Windows Update. Look like one of the latest windows update fixed this problem. So I can confirm that the issue stopped happening for me from the last 2 months.

like image 45
nnhthuan Avatar answered Sep 25 '22 11:09

nnhthuan