-
Notifications
You must be signed in to change notification settings - Fork 859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 File System Goes Into Read Only Mode Without Warning #8340
Comments
I guess at least one solution is to wait until the system goes into readonly mode and then run the sudo e2fsck command with -f |
Attach VHD without mount on other distros, and run e2fsck. |
Unfortunately my environment doesn't seem to have the wsl --mount command available. I was going to try this, but wasn't successful. |
It indeed looks like the VHD is corrupted and needs e2fsck. If wsl --mount is not available, creating a linux VM and manually attaching the VHD manually so e2fsck can run should work. If not, I'd recommend updating to a build that supports wsl --mount. |
I was able to fix this issue by running After that it came back up just fine. |
Version
Microsoft Windows [Version 10.0.19043.1645]
WSL Version
Kernel Version
5.10.16
Distro Version
Ubuntu 20.04
Other Software
No response
Repro Steps
I have no specific steps. One minute things are fine, the next minute my file system is read only. If I do a wsl --shutdown, the next time I open a WSL session the file system work again, but it seems within a few minutes the file system will lock again.
Expected Behavior
I am not expecting the file system to randomly go into read-only mode.
Actual Behavior
The file system randomly goes into read-only mode. If I run wsl --shutdown from Powershell and then open a new WSL session, the file system goes back to read/write. I suspect some sort of file system error from information I see in the dmesg output. I'm running WSL2 on a new laptop with a 500gb SSD with approximately 170gb free. I've seen other responses to a similar problem with people suggesting running e2fsck, but I can't run that command because the file system is mounted.
Some additional information:
I'm running WSL but accessing the file system with both IntelliJ and VS Code from Windows. I'm using the VS Code Remote capabilities and IntelliJ has something similar that allows it to work with WSL files from the Windows application. I'm also using typical tools like git from within the WSL environment. I also have Docker Desktop running.
I've found some instructions elsewhere that describe how to mount the device ro, run e2fsck, and remount the device, i.e.
but I could never get the unmount to work since it told me the mount point was busy.
I guess my main question is, how do you 'repair' a WSL disk? I can't run fsck on a mounted volume, but I can't unmount it because I won't be able to access it. There must be some way to do this.
Diagnostic Logs
The partial content of sudo dmesg -w looks like this:
After closing all WSL windows and performing a wsl --shutdown, when I restart my Ubuntu environment, I see this in the dmesg logs:
The text was updated successfully, but these errors were encountered: