-
Notifications
You must be signed in to change notification settings - Fork 826
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 corrupts ext4 filesystem #5895
Comments
I have also encountered this when |
The only corruption problem I had so far with wsl2 was when once my vhdx expanded with little disk space available in the system drive. WSL2 uses by default a dynamic vhdx that can grow until 256Gb but it seems the linux distro never knows what's really happening in the host disk. Having little disk space available in C: could be a reason, another reason could be the vhdx was fully expanded and trying to write more in it did bring the corruption problem. For that try to expand the vhdx disk size and see if it lasts more days until corruption. |
Some relevant facts before running into this:
I cannot see other relevant facts. Today I've run again into this:
I will have to re-install wsl2 as it has become painful. |
WSL2 vhdx disk sure needed more space to breathe. Were C and D contiguous partitions? What do you see now in Disk Manager? Dynamic (olive) or basic disk (blue)? |
Bad news is that I have:
Looks like a wsl2 bug.. some app should not corrupt a file system. |
When that happens, is the ext4.vhdx disk completely enlarged? (filesize +256Gb) |
No, current size is on disk is 7.90 GB |
Weird. It does not allow me to resize. DISKPART> Select vdisk file="C:\Users\liviu.ungureanu\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx" DiskPart successfully selected the virtual disk file. DISKPART> expand vdisk maximum=100000 DiskPart has encountered an error: The parameter is incorrect. Note: |
Too weird. Remember you can always export a distro to another partition/disk with the |
Is the disk HDD, SDD, NVME? |
SDD |
Ok, thanks. If you have another disk with enough space try to export the distro there. About the Diskpart error, did you try with something like |
I do not have another disk :-) I guess I've got a more narrow isolation of the problem.
wsl2 should suddenly stop:
PS C:\Users\liviu.ungureanu> wsl -l -v Though in this case it looks like file system is not corrupted even wsl2 dies suddenly. Question: my sdd is encrypted. Could this contribute in any way to the problem? |
A large file? Sounds similar to #5410 |
ok, I'll give it a try with .wslconfig |
We took a look at this problem but weren't able to diagnose any obvious WSL related problems. It's definitely hard for us to repro this problem. As @onomatopellan mentioned, we're also wondering if this is disk related. If you are able to, could you please try running the same repro steps on another disk? |
@craigloewen-msft I hit this too, #5026 seems to be related. It seems to be more reliably triggered if you run |
To add on the above, long machine suspend state or hibernation also trigger the corruption. |
I decrypted my disk just to eliminate this track. I still get corruptions when I/O is suddenly intensive(i.e Intellij is re-indexing a large project due to some dependency update) The corruption can be more or less virlulent. In this case @craigloewen-msft I haven't time to try with some other disk as I am working on a office laptop. But as the picture a bit above shows it looks healthy. |
Thanks for the additional info! We'll keep trying on the dev team to see if we can get a repro for this (I've tried the shutdown trick @anaisbetts mentioned a few times but haven't had any 'luck' yet). If anyone else can find a way to repro this consistently please comment it and tag me in it. |
@craigloewen-msft That's surprising, on my computer it hits nearly 100% of the time. Use the VM for something real, wait a bit, |
We've identified the issue that has been causing this, and have put in a fix! I'll leave this issue open as our landing zone for the WSL repo, and will be posting updates here and on the popular issue on the WSL 2 kernel repo: https://github.com/microsoft/WSL2-Linux-Kernel/issues/168 |
This is fixed in Insiders preview build 21292, can any folks here who see this issue install this build and let us know if that resolves you? Thank you! |
@craigloewen-msft Good news! Unfortunately I will have to wait for the official roll-out since on my laptop I am not allowed to run windows insider builds. |
Unfortunately not yet. I will update these threads with details if this fix becomes available on more versions. |
|
What I currently do, when docker is not starting anymore because of this:
|
Here seems to be a strange phenomenon: although the check program shows an 'EXT4-fs error', my Docker Desktop program can still start normally. What should I do? Please investigate the following 1 issue:
1 : The test: is the WSL 2 Linux filesystem corrupt?
Failed with: [ 53.530731] EXT4-fs error (device sdc): ext4_put_super:1188: comm weston: Couldn't clean up the journal
If the WSL 2 Linux filesystem is corrupt then Docker Desktop cannot start.
There is a known issue fixed in Windows Insider builds which can cause filesystem corruption, see:
https://github.com/microsoft/WSL/issues/5895 .
Try running "wsl --shutdown" to stop your WSL Virtual Machine. When it restarts it will
run a filesystem check and hopefully fix the problem. WSL WSL version: 1.2.5.0
Windows version: 10.0.22621.1702 Docker Docker version 23.0.5, build bc4487a |
I did not notice any corrupt files. Shutting down wsl keeps the same error to be not able to start the docker engine. Update: |
I have a similar error. In my case, it seems that WSL2 filesystem file gets corrupted which prevents WSL2 from booting. Thus, it generates a timeout error.
Here is a relatively simple way to restore a corrupted filesystem. It worked for me. Restoring corrupted WSL2 ext4 filesystem.
|
Hello! We have spotted this with docker/for-win#13716 - Currently unsure if the two are related, but possible. Would be good to have a fix. |
amazing! |
I found another solution that happily worked on my PC.
Optional steps, but I wanted to remove Kali
|
I also having this problem. My problem is some of my system files become zero sized:
|
Holy crap it's has been years. Is there any update for this? |
I am experiencing this issue now too, completely out the blue. |
# This script is used to fix Ubuntu VHD in WSL 2 by performing the following steps:
# Step 1: Shutdown WSL
# wsl --shutdown
wsl --terminate Ubuntu
# Step 2: Mount the Ubuntu data VHDX file
wsl --mount --bare --vhd "C:\Users\$env:USERNAME\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx"; wsl --debug-shell
lsblk
# Step 5: Run filesystem check on the mounted disk
# wsl.exe sudo e2fsck -f /dev/$(wsl -e bash -c "lsblk --noheadings --raw --output KNAME | awk '{print $1}' | sort | tail -n 1")
e2fsck -f -y /dev/sdb
exit
# Step 6: Unmount the disk in WSL
# wsl --unmount $deviceID
# Step 7: Dismount the Ubuntu data VHDX file
wsl --unmount "C:\Users\$env:USERNAME\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx"
|
Environment
Platform ServicePack Version VersionString
Win32NT 10.0.19041.0 Microsoft Windows NT 10.0.19041.0
lsb_release -r
Release: 20.04
cat /proc/version
Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020
Steps to reproduce
I am using Intellij linux version running in WSL2 and connected to a X410 server for GUI .
While intellij is running some apps WSL2 suddenly stops.
After a start again wsl2 I see that
WSL logs:
Expected behavior
Do not corrupt the ext4 file system.This makes WS2 quite unreliable it would be fine to be fixed as soon as posible.
Actual behavior
Every two 2-3 days the ext4 file system gets currupted.
The text was updated successfully, but these errors were encountered: