@matigo is probably correct with the comment regarding filesystem corruption. I also agree that the WSL2 use of ext4 is almost certainly more robust if it fits your needs.
If you haven't already, do a wsl --shutdown
(from PowerShell) to make sure any handles/locks are released. Then restart and try again. It has a relatively small chance of working, but it's worth a shot since it's so quick.
If that doesn't work, I'd recommend the following for attempting to repair the WSL1 instance.
Basically round-trip the WSL1 instance through a wsl --export
/wsl --import
. The tar
round-trip that this process performs should (hopefully) remove the corrupted file when archiving or unarchiving, one or the other.
From PowerShell:
# Confirm the distribution name
wsl -l -v
# Distribution name may be "Ubuntu" or "Ubuntu-20.04" - Adjust the following lines accordingly:
wsl --shutdown
cd ~\Documents
mkdir WSL\images
mkdir WSL\instances\UbuntuRecovery
wsl --export Ubuntu WSL\images\ubuntu.tar
wsl --import UbuntuRecovery WSL\instances\UbuntuRecovery WSL\images\ubuntu.tar --version 1
wsl -d UbuntuRecovery
See if the file is gone or deletable in that new instance.
If so, and if everything else looks okay in the new instance, then:
The new instance will be the default whenever wsl
is run.
Finally, remove the original corrupted instance with:
wsl --unregister Ubuntu
Important: This is a destructive operation. Make sure that everything is working as intended. On the bright side, we've made a backup already ...
You can also uninstall the Ubuntu "App" that was installed from the Store at that point.
You'll launch via wsl
(if you haven't been already) or Windows Terminal since the ubuntu.exe
(or ubuntu2004.exe
) command will be gone.