'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?



Solution 1:[1]

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

Solution 2:[2]

I faced the same issue. So I made a .bat file which contains wsl --shutdown , and put it's shortcut in C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup so every time the PC starts, it does it automatically.

You can get the above said directory if you enter shell:startup in run window (win+r).

Solution 3:[3]

I'm not facing this. Could it be that your WSL is set to start when Windows starts?

Recommend looking at Start-up apps in the Task Manager, and in Windows Settings. Also, maybe look at Services and Task Scheduler.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hoang
Solution 2 radvin
Solution 3 eccentricOrange