WSL: WSL2 cannot access 'c': Input/output error
Environment
Windows 10 Pro 19041.572
Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Your Distribution version: [On Debian or Ubuntu run `lsb_release -r` in WSL]
Whether the issue is on WSL 2 and/or WSL 1: [run `cat /proc/version` in WSL]
Steps to reproduce
From the wsl2 console navigate to c folder Perform any operation on any c folder, such as ls, or vim. I get WSL2 cannot access ‘c’: Input/output error. wsl --shutdown does not fixt the issue
WSL logs: https://aka.ms/AAa4w8z
Expected behavior
I need to be able to do any IO operations on the C drive. On WSL1, this issue is invalid. It only occurs on WSL2
Actual behavior
Getting cannot access ‘c’: Input/output error when accessing the c folder
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 45 (1 by maintainers)
Related: https://github.com/microsoft/WSL/issues/4377 Altough people there can fix it by
wsl --shutdownSame happens to me. I’m not sure whether this is a random thing or happens right after sleep or hibernate. Will have to investigate more. Anyway, there are 2 workarounds that work for me.
Then, start your WSL2 instance again
When you have to run it routinely I can’t believe it’s a solution.
Somehow upgrading to Windows 11 fixed this problem for me. Not sure what they did but seems like I no longer need to do a
wsl --shutdownon boot.In my case with WSL2 debian even if I restart
wslhost.exeviawsl --shutdownthe problem persistMaybe this helps figuring out what’s going on. On my system (exported/imported multiple Debian VMs, fresh Windows installation with WSL2 - no WSL1 ever been on that system) I am getting those connection issues almost every day (using Docker Desktop) and/or docker issues (forgetting which WSL2 integrations it should have).
The workaround that seems to be working for me:
wsl --shutdown- so docker and the VMs are downwsl --list -vshows all VMs with a docker connection as running)If I don’t do that I have the input/ouptut errors (almost every time) or the VM can’t work with docker or … - maybe this is helping figuring out what’s going on (timing issue with network/docker/wsl/…) or helping somebody to make wsl usable. In the 2nd case we could write a short script for a “semi stable boot process” until this issue is solved…
If one of the other tickets regarding this error is the correct one… feel free to move or give me a hint.
Nope, Windows 11 did not fix it for me. Same error same everything.
Does the fact that I am running VS Code portably matter? i.e it’s not really installed on the Windows 10/11 side, but running off a USB drive. Maybe there’s some setting I need to manually configure?
Restarting the Lxssmanager services solves it for about 2-4 hours and then it happens again. This bug needs to be assigned to someone.
I’ve also been hitting this across a wide range of WSL2 versions, using wsl --shutdown after startup does help.
Additional info:
[automount] options = "metadata"does not help for me.Included both a dmesg from before, and after wsl --shutdown.
BEFORE / BROKEN:
AFTER / WORKING:
Additional Info:
@humbienri
wsl --shutdownshould work generally. If not you can try restart the service calledLXSSMANAGER. If either of them works, try doing the full reboot.Btw, I no longer see this issue on Windows 11. 😃
another update: adding
[automount] options = "metadata"to/etc/wsl.confseems to fix the issue for now. Will keep monitoring and mention if it reoccursSame on Windows 1909 (can’t upgrade due to corporate system). Workaround of sudo umount /mnt/c and sudo mount -t drvfs C:\ /mnt/c works.
Work for me, thank you
False alarm, the issue still exists.
If you want to avoid entering the password upon logon or any sort of prompts, I’ve added a slight modification.
I have the error randomly sometimes when I reboot the computer, the first time I open a WSL console.
As a workaround I have added following lines to the .bashrc file:
So it will ask me to enter the sudo password only in case it detects the issue.
try the following command, it worked for me, with no need to restart WSL sudo umount /mnt/c ; sudo mount -t drvfs C: /mnt/c -o metadata
https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/
Well
wsl --shutdownis a workaround. There is ain’t no solution yet?Switched from WSL to WSL2 a few weeks back and have had this issue from the get-go. Only occurs for me after the initial launch of WSL. Once fixed, by running
wsl --shutdownandwsl, the issue is resolved until a full pc reboot.Saw on another thread that canceling a process (ctrl+C) may be the culprit. Haven’t been paying that close attention, but my most recent run in with this issue occurred immediately following the canceling of a process.
Windows v10.19042.985 & Linux kernel v5.4.72-microsoft-standard-WSL2
Edit: just tried a couple of reboots and can confirm that ctrl+C isn’t the culprit, at least not for me. Trying to access the C: drive right after WSL boots up still produces the error.
I’ve passed through that ‘sensation’ once or twice over fresh installs. Once you install VSCode it just takes about 1-2 months for the issue to re-appear (not sure if the WSL install date affects it). Exception is then disabling Fast Startup for me ignoring the other scripted alternatives, which I’m going to keep using for now.
Note: I’m merely refering to the issue affecting VSCode on WSL remote connection, which is my affected scenario like other people’s, with some GitHub issues redirecting to this one.