Sadly, I don't have great news for you; only perhaps a suggestion when reinstalling that will hopefully prevent it from happening again.
First up, the Reset option in the screenshot you posted does say specifically:
If this app isn't working right, reset it. The app's data will be deleted.
So yes, a Reset did get rid of the entire Ubuntu WSL data (the filesystem and registry data).
A Repair, on the other hand, keeps the WSL Ubuntu distribution intact.
Important note: These options, and the wording behind them in the settings, are the same for all Store apps. I know that the Uninstall wording says:
Your documents will not be affected.
However, the way WSL installations are handled, an uninstall does remove the entire instance. The documents are part of the filesystem, which is removed on an uninstall.
I've seen cases where the Store apps are being reset for other reasons, resulting in WSL data loss. For that reason (and more), I recommend the following ...
Preventing Uninstall and Reset from removing WSL data
I'm seriously thinking about doing my first YouTube video on this soon. When installing Ubuntu (or any other distribution) in WSL, the first thing I do is "disconnect" the instance from the Store installation by "moving" it to its own directory.
By default, WSL distributions are installed into:
%UserProfile%\AppData\Local\Packages\<DistributionPackage>\
This includes the virtual filesystem, either:
- WSL2:
..\<DistributionPackage>\LocalState\ext4.vhdx
- WSL1:
..\<DistributionPackage>\LocalState\rootfs\
For Ubuntu, that <DistributionPackage>
name is going to start with Canonical
and include Ubuntu
in the name (along with other identifiers).
It's worth checking to see if that directory is still there. If so, your data could be recoverable. However, I don't believe it's likely. It's more likely that, if you've rerun ubuntu.exe
after the Reset, that it's the new installation that is there.
Anyway, I recommend this process for "disconnecting" the Store install so this doesn't happen again:
Once you've installed Ubuntu and configured your username and password.
Exit Ubuntu
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\MyUbuntu
wsl --export Ubuntu WSL\images\ubuntu_clean.tar
wsl --import MyUbuntu WSL\instances\MyUbuntu WSL\images\ubuntu_clean.tar --version 2
Note that most of the directory and filenames above (and the instance name) are up to you.
You should now have two Ubuntu installations, as you can confirm with wsl -l -v
.
Launch the new one with wsl -d MyUbuntu
--import
ed instances don't "remember" your default username (although the user still exists). Set the default username in that instance via a /etc/wsl.conf
file per this answer. Specifically:
sudo -e /etc/wsl.conf
And add the following lines:
[user]
default=<yourusername>
Exit the instance
Again, from PowerShell:
wsl --terminate MyUbuntu
wsl --set-default MyUbuntu
Now, the default instance is MyUbuntu
. It is what will launch whenever you start WSL with the wsl
command.
Uninstall the Store Ubuntu. You won't have to worry about it being reset again.
If you do need to try something out in Ubuntu that you feel might cause issues, do it in a new temporary instance:
Again, in PowerShell:
cd ~\Documents\WSL
mkdir instances\UbuntuTest
wsl --export MyUbuntu images\current_ubuntu.tar
wsl --import UbuntuTest instances\UbuntuTest images\current_ubuntu.tar --version 2
wsl -d UbuntuTest
That's a separate instance that you can install in, change configuration, go wild. When you are doing with it, exit and:
wsl --unregister UbuntuTest
This will delete that test instance, and leave MyUbuntu
intact.
Note, of course, that the entire UbuntuTest
instance will be gone, so make sure you don't create any documents or data that you need there longterm.