15

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?

nnhthuan
  • 1,887
  • 2
  • 17
  • 40
  • Not sure about the only one who downed vote, but not even left a comment or answer. :) – nnhthuan Sep 14 '20 at 14:37
  • To be honest I've been having problems with WSL2 this week and I am not sure on how to solve them. Same issue as you have actually. I installed a new WSL2 distro (Debian), and now it seems solved, but the code command no longer works to start visual studio code. – froginvasion Sep 18 '20 at 06:05
  • 1
    @froginvasion yeah, now, everyday I turn on my PC for working, I have to run `wsl.exe --shutdown` to make it works. – nnhthuan Sep 19 '20 at 05:27
  • 1
    I can confirm this – Ahmed I. Elsayed Oct 20 '20 at 08:23

4 Answers4

4

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

Smithienious
  • 120
  • 3
  • 9
  • Can you include extra details or a source which suggests why this would be an issue with fast startup? – Hoppeduppeanut Mar 25 '21 at 05:54
  • This has mainly to do with my past experience with fast startup, and it's not specifically related to WSL. My search history was full of error codes if you are interested. – Smithienious Mar 25 '21 at 06:17
  • 3
    Fast Startup is a form of hibernation, which also causes issues with the networking functionality in WSL. I agree with @Smithienious that if a `wsl --shutdown` is resolving it, Fast Startup or hibernation is a likely cause. I originally found this somewhere in [this](https://github.com/microsoft/WSL/issues/4636) Github issue, and it's been confirmed by some comments and upvotes on [this](https://stackoverflow.com/a/63455770/11810933) answer. There's another question/answer I participated in that indicated drive mounting may be a part of the same subsystem, but I don't have it handy right now. – NotTheDr01ds Mar 25 '21 at 09:51
  • 1
    Fast startup is really a cool feature and it's saving a lot of time. We can hard restart if needed, but most of time, we will want fast startup. Hence, disabling it is not a good idea. 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). – nnhthuan Mar 26 '21 at 12:53
  • This isn't the root cause. It still happens without fast startup. Workaround is just to run `wsl.exe --shutdown` when you need. – nnhthuan Jun 26 '21 at 02:27
3

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.

nnhthuan
  • 1,887
  • 2
  • 17
  • 40
0

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

radvin
  • 1
  • 2
0

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.

eccentricOrange
  • 556
  • 4
  • 12