25

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?

  • 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. –  Sep 19 '20 at 05:27
  • 1
    I can confirm this – Ahmed I. Elsayed Oct 20 '20 at 08:23

4 Answers4

5

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

Hoang
  • 167
  • 3
  • 12
  • 1
    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
  • 4
    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
  • 2
    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). –  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. –  Jun 26 '21 at 02:27
5

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.

1

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
  • 11
  • 3
0

I can confirm wsl --shutdown works. Another habit can be shutting down the laptop when not in use. This allows Windows 10 to gracefully end all the processes.

ricwambugu
  • 81
  • 1
  • 4